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)
Page Memory (MB) CPU Time (ms)
Home / 3.53 ▲0.07 37.57 ▼6.69
Dashboard /wp-admin 3.44 ▲0.14 51.53 ▲0.74
Posts /wp-admin/edit.php 3.56 ▲0.20 50.85 ▼1.15
Add New Post /wp-admin/post-new.php 6.02 ▲0.14 98.21 ▼0.67
Media Library /wp-admin/upload.php 3.37 ▲0.14 36.04 ▲1.15
Languages /wp-admin/admin.php?page=loco-lang 4.79 556.81
WordPress /wp-admin/admin.php?page=loco-core 3.66 30.78
Themes /wp-admin/admin.php?page=loco-theme 4.51 45.46
Plugins /wp-admin/admin.php?page=loco-plugin 4.43 39.52
Settings /wp-admin/admin.php?page=loco-config 3.84 36.10
Home /wp-admin/admin.php?page=loco 4.82 44.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
Page Nodes Memory (MB) Script (ms) Layout (ms)
Home / 2,868 ▲133 13.21 ▼1.02 1.88 ▲0.10 39.26 ▼2.94
Dashboard /wp-admin 2,246 ▲58 5.84 ▼0.04 100.99 ▼8.40 41.96 ▼1.41
Posts /wp-admin/edit.php 2,132 ▲43 2.01 ▲0.02 39.11 ▲1.23 36.14 ▼0.69
Add New Post /wp-admin/post-new.php 1,567 ▲34 23.25 ▲0.11 665.03 ▼22.84 53.66 ▼10.35
Media Library /wp-admin/upload.php 1,428 ▲40 4.18 ▼0.02 93.50 ▼17.67 42.83 ▼4.91
Languages /wp-admin/admin.php?page=loco-lang 1,006 2.40 33.28 32.46
WordPress /wp-admin/admin.php?page=loco-core 1,141 2.23 32.73 32.29
Themes /wp-admin/admin.php?page=loco-theme 1,091 2.40 28.76 22.48
Plugins /wp-admin/admin.php?page=loco-plugin 1,028 2.25 33.04 23.87
Settings /wp-admin/admin.php?page=loco-config 1,447 2.24 26.42 23.41
Home /wp-admin/admin.php?page=loco 1,069 2.23 26.86 28.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:
Language Files Blank lines Comment lines Lines of code
PHP 238 3,560 7,968 16,118
JavaScript 13 22 0 6,431
SVG 1 0 0 119
XML 1 0 0 24
CSS 17 0 0 17
Markdown 1 2 0 3

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 code 0.41
Average class complexity 16.08
▷ Minimum class complexity 1.00
▷ Maximum class complexity 91.00
Average method complexity 3.16
▷ Minimum method complexity 1.00
▷ Maximum method complexity 46.00
Code structure
Namespaces 0
Interfaces 3
Traits 0
Classes 180
▷ Abstract classes 33 18.33%
▷ Concrete classes 147 81.67%
▷ Final classes 0 0.00%
Methods 1,302
▷ Static methods 157 12.06%
▷ Public methods 1,119 85.94%
▷ Protected methods 52 3.99%
▷ Private methods 131 10.06%
Functions 38
▷ Named functions 38 100.00%
▷ Anonymous functions 0 0.00%
Constants 19
▷ Global constants 11 57.89%
▷ Class constants 8 42.11%
▷ Public constants 8 100.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
File Size - original Size - compressed Savings
pub/img/wg/splitx.png 0.08KB 0.08KB 0.00%
pub/img/api/microsoft.png 0.72KB 0.74KB 0.00%
pub/img/api/google.png 0.57KB 0.58KB 0.00%
pub/img/flags-16.png 12.98KB 13.78KB 0.00%
pub/img/api/[email protected] 1.26KB 1.28KB 0.00%