84% gp-machine-translate

Code Review | GP Machine Translate

WordPress plugin GP Machine Translate scored84%from 54 tests.

About plugin

  • Plugin page: gp-machine-translate
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.2
  • WordPress version: 6.3.1
  • First release: Dec 15, 2015
  • Latest release: Apr 17, 2023
  • Number of updates: 30
  • Update frequency: every 89.3 days
  • Top authors: GregRoss (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

20+ active /3,595 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.11MB] [CPU: ▼2.54ms] Passed 4 tests

Analyzing server-side resources used by GP Machine Translate
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1139.30 ▼0.49
Dashboard /wp-admin3.42 ▲0.1149.51 ▲0.78
Posts /wp-admin/edit.php3.53 ▲0.1750.06 ▼3.98
Add New Post /wp-admin/post-new.php6.00 ▲0.1194.32 ▼6.48
Media Library /wp-admin/upload.php3.34 ▲0.1140.25 ▲3.79

Server storage [IO: ▲0.07MB] [DB: ▲0.00MB] Passed 3 tests

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

Browser metrics Passed 4 tests

Checking browser requirements for GP Machine Translate
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.30 ▼0.061.68 ▼0.1539.89 ▼1.90
Dashboard /wp-admin2,195 ▲155.62 ▼0.0385.85 ▼3.1338.76 ▼6.18
Posts /wp-admin/edit.php2,100 ▼31.99 ▼0.0339.60 ▼1.8540.98 ▲5.64
Add New Post /wp-admin/post-new.php1,554 ▲718.21 ▼4.95668.90 ▲41.1755.39 ▼0.57
Media Library /wp-admin/upload.php1,400 ▼04.28 ▲0.0598.10 ▲2.0845.04 ▲0.16

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gp-machine-translate/gp-machine-translate.php:767
    • > PHP Fatal error
      Uncaught Error: Class 'MicrosoftTranslator\\Translate' not found in wp-content/plugins/gp-machine-translate/vendor/natxet/microsoft-translation-api/example/example.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/gp-machine-translate/ajax.php:24

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
8 plugin tags: translate, glotpress plugin, yandex, google, bing...

gp-machine-translate/gp-machine-translate.php Passed 13 tests

The primary PHP file in "GP Machine Translate" version 1.0 is used by WordPress to initiate all plugin functionality
39 characters long description:
Machine Translate plugin for GlotPress.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin1,304 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP172663961,152
JSON30083
JavaScript15051
Markdown18018

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity20.14
▷ Minimum class complexity1.00
▷ Maximum class complexity78.00
Average method complexity3.73
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods51
▷ Static methods35.88%
▷ Public methods4180.39%
▷ Protected methods35.88%
▷ Private methods713.73%
Functions6
▷ Named functions350.00%
▷ Anonymous functions350.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There were not PNG files found in your plugin