78% loco-translate

Code Review | Loco Translate

WordPress plugin Loco Translate scored78%from 54 tests.

About plugin

  • Plugin page: loco-translate
  • Plugin version: 2.6.6
  • PHP compatiblity: 5.6.20+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.3.1
  • WordPress version: 6.3.1
  • First release: Jul 23, 2013
  • Latest release: Sep 1, 2023
  • Number of updates: 726
  • Update frequency: every 5.1 days
  • Top authors: timwhitlock (100%)

Code review

54 tests

User reviews

407 reviews

Install metrics

1,000,000+ active /22,762,723 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.12MB] [CPU: ▼1.94ms] 75% from 4 tests

An overview of server-side resources used by Loco Translate
It is recommended to improve the following
  • CPU: Total CPU usage should be kept under 500.00ms (currently 556.81ms on /wp-admin/admin.php?page=loco-lang)
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0737.57 ▼6.69
Dashboard /wp-admin3.44 ▲0.1451.53 ▲0.74
Posts /wp-admin/edit.php3.56 ▲0.2050.85 ▼1.15
Add New Post /wp-admin/post-new.php6.02 ▲0.1498.21 ▼0.67
Media Library /wp-admin/upload.php3.37 ▲0.1436.04 ▲1.15
Languages /wp-admin/admin.php?page=loco-lang4.79556.81
WordPress /wp-admin/admin.php?page=loco-core3.6630.78
Themes /wp-admin/admin.php?page=loco-theme4.5145.46
Plugins /wp-admin/admin.php?page=loco-plugin4.4339.52
Settings /wp-admin/admin.php?page=loco-config3.8436.10
Home /wp-admin/admin.php?page=loco4.8244.90

Server storage [IO: ▲1.59MB] [DB: ▲0.05MB] Passed 3 tests

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 309 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Loco Translate
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,868 ▲13313.21 ▼1.021.88 ▲0.1039.26 ▼2.94
Dashboard /wp-admin2,246 ▲585.84 ▼0.04100.99 ▼8.4041.96 ▼1.41
Posts /wp-admin/edit.php2,132 ▲432.01 ▲0.0239.11 ▲1.2336.14 ▼0.69
Add New Post /wp-admin/post-new.php1,567 ▲3423.25 ▲0.11665.03 ▼22.8453.66 ▼10.35
Media Library /wp-admin/upload.php1,428 ▲404.18 ▼0.0293.50 ▼17.6742.83 ▼4.91
Languages /wp-admin/admin.php?page=loco-lang1,0062.4033.2832.46
WordPress /wp-admin/admin.php?page=loco-core1,1412.2332.7332.29
Themes /wp-admin/admin.php?page=loco-theme1,0912.4028.7622.48
Plugins /wp-admin/admin.php?page=loco-plugin1,0282.2533.0423.87
Settings /wp-admin/admin.php?page=loco-config1,4472.2426.4223.41
Home /wp-admin/admin.php?page=loco1,0692.2326.8628.92

Uninstaller [IO: ▲0.00MB] [DB: ▲0.05MB] 75% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 7× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/loco-translate/tpl/admin/help/tab-file-view.php
    • > /wp-content/plugins/loco-translate/tpl/admin/help/tab-locale-view.php
    • > /wp-content/plugins/loco-translate/tpl/admin/help/tab-list-locales.php
    • > /wp-content/plugins/loco-translate/tpl/debug/dump.php
    • > /wp-content/plugins/loco-translate/tpl/admin/help/tab-bundle-view.php
    • > /wp-content/plugins/loco-translate/tpl/admin/help/tab-list-bundles.php
    • > /wp-content/plugins/loco-translate/tpl/admin/help/tab-home.php
  • 187× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/loco-translate/tpl/admin/errors/no-tokenizer.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/loco-translate/tpl/ajax/modal-apis-empty.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Loco_mvc_AjaxController' not found in wp-content/plugins/loco-translate/src/ajax/PingController.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/loco-translate/tpl/admin/file/info-pot.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/loco-translate/tpl/admin/file/view-mo.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/loco-translate/tpl/admin/bundle/debug.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/loco-translate/tpl/admin/help/tab-init-po.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Loco_mvc_AjaxController' not found in wp-content/plugins/loco-translate/src/ajax/FsConnectController.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Loco_admin_file_BaseController' not found in wp-content/plugins/loco-translate/src/admin/file/HeadController.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Loco_fs_FileList' not found in wp-content/plugins/loco-translate/src/fs/LocaleFileList.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that require attention:
  • Tags: Too many tags (12 tag instead of maximum 10); only the first 5 tags are used in your directory listing
Please take inspiration from this readme.txt

loco-translate/loco.php 92% from 13 tests

The principal PHP file in "Loco Translate" v. 2.6.6 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("loco-translate.php" instead of "loco.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Good job! No executable or dangerous file extensions detected22,712 lines of code in 271 files:
LanguageFilesBlank linesComment linesLines of code
PHP2383,5607,96816,118
JavaScript132206,431
SVG100119
XML10024
CSS170017
Markdown1203

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity16.08
▷ Minimum class complexity1.00
▷ Maximum class complexity91.00
Average method complexity3.16
▷ Minimum method complexity1.00
▷ Maximum method complexity46.00
Code structure
Namespaces0
Interfaces3
Traits0
Classes180
▷ Abstract classes3318.33%
▷ Concrete classes14781.67%
▷ Final classes00.00%
Methods1,302
▷ Static methods15712.06%
▷ Public methods1,11985.94%
▷ Protected methods523.99%
▷ Private methods13110.06%
Functions38
▷ Named functions38100.00%
▷ Anonymous functions00.00%
Constants19
▷ Global constants1157.89%
▷ Class constants842.11%
▷ Public constants8100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
10 compressed PNG files occupy 0.05MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
pub/img/wg/splitx.png0.08KB0.08KB0.00%
pub/img/api/microsoft.png0.72KB0.74KB0.00%
pub/img/api/google.png0.57KB0.58KB0.00%
pub/img/flags-16.png12.98KB13.78KB0.00%
pub/img/api/deepl@2x.png1.26KB1.28KB0.00%