78% smartling-connector

Code Review | Smartling Connector

WordPress plugin Smartling Connector scored78%from 54 tests.

About plugin

  • Plugin page: smartling-connector
  • Plugin version: 3.8.0
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.4.1
  • WordPress version: 6.3.1
  • First release: Oct 30, 2015
  • Latest release: Dec 1, 2023
  • Number of updates: 597
  • Update frequency: every 5.0 days
  • Top authors: smartling (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /31,966 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼11.57ms] Passed 4 tests

Server-side resources used by Smartling Connector
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0031.13 ▼10.20
Dashboard /wp-admin3.31 ▼0.0445.01 ▼18.19
Posts /wp-admin/edit.php3.36 ▲0.0049.45 ▼4.32
Add New Post /wp-admin/post-new.php5.89 ▲0.0090.73 ▼13.58
Media Library /wp-admin/upload.php3.24 ▲0.0034.82 ▲2.62

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 1,106 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Smartling Connector
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲4314.27 ▼0.241.66 ▲0.1036.57 ▼6.73
Dashboard /wp-admin2,198 ▲185.58 ▼0.1792.60 ▼5.2241.67 ▼4.53
Posts /wp-admin/edit.php2,100 ▼02.00 ▲0.0039.65 ▼0.3435.78 ▼2.98
Add New Post /wp-admin/post-new.php1,526 ▼2323.26 ▲3.97665.61 ▲11.1850.39 ▼23.59
Media Library /wp-admin/upload.php1,397 ▼34.30 ▲0.0795.03 ▼6.0540.64 ▼5.02

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
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 9× PHP files output text when accessed directly:
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/context-example.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-symfony/expression-language/Resources/bin/generate_operator_regex.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/jobs-example.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/project-example.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/translation-requests-example.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/batch-example.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/file-example.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/audit-log-example.php
    • > /wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/examples/progress-tracker-example.php
  • 611× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Smartling\\Vendor\\Symfony\\Component\\Config\\Definition\\Builder\odeParentInterface' not found in wp-content/plugins/smartling-connector/inc/lib/smartling-connector-symfony/config/Definition/Builder/NodeDefinition.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Smartling\\Vendor\\Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag' not found in wp-content/plugins/smartling-connector/inc/lib/smartling-connector-symfony/dependency-injection/ParameterBag/FrozenParameterBag.php:20
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/smartling-connector/inc/Smartling/WP/View/SubmissionsPage.php:11
    • > PHP Fatal error
      Trait 'Smartling\\DebugTrait' not found in wp-content/plugins/smartling-connector/inc/Smartling/Bootstrap.php on line 35
    • > PHP Fatal error
      Uncaught Error: Interface 'Smartling\\Vendor\\Symfony\\Component\\DependencyInjection\\Exception\\ExceptionInterface' not found in wp-content/plugins/smartling-connector/inc/lib/smartling-connector-symfony/dependency-injection/Exception/LogicException.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/smartling-connector/inc/lib/smartling-connector-smartling/api-sdk-php/tests/unit/ApiTestAbstract.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Smartling\\Vendor\\Monolog\\Handler\\AbstractHandler' not found in wp-content/plugins/smartling-connector/inc/lib/smartling-connector-monolog/monolog/src/Monolog/Handler/BufferHandler.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/smartling-connector/inc/lib/smartling-connector-symfony/config/Tests/Definition/Builder/TreeBuilderTest.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'WP_List_Table' not found in wp-content/plugins/smartling-connector/inc/Smartling/WP/Table/LocalizationRulesTableWidget.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Smartling\\Vendor\\Symfony\\Component\\DependencyInjection\\Dumper\\DumperInterface' not found in wp-content/plugins/smartling-connector/inc/lib/smartling-connector-symfony/dependency-injection/Dumper/Dumper.php:20

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
10 plugin tags: internationalization, multilingual, localisation, automation, international...

smartling-connector/smartling-connector.php Passed 13 tests

"Smartling Connector" version 3.8.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
94 characters long description:
Integrate your WordPress site with Smartling to upload your content and download translations.

Code Analysis 97% from 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
No dangerous file extensions were detected107,822 lines of code in 1,066 files:
LanguageFilesBlank linesComment linesLines of code
PHP92815,72328,70589,705
JavaScript199654015,425
Markdown331,44104,450
YAML432791184,124
JSON20001,923
CSS5155531,684
XML12225226
XSD2230197
PO File1191954
HTML10015
Dockerfile18010
make1409

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
The following items need your attention
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity9.85
▷ Minimum class complexity1.00
▷ Maximum class complexity244.00
Average method complexity2.41
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces132
Interfaces88
Traits21
Classes756
▷ Abstract classes415.42%
▷ Concrete classes71594.58%
▷ Final classes243.36%
Methods5,464
▷ Static methods55510.16%
▷ Public methods4,37780.11%
▷ Protected methods3716.79%
▷ Private methods71613.10%
Functions387
▷ Named functions13234.11%
▷ Anonymous functions25565.89%
Constants699
▷ Global constants7911.30%
▷ Class constants62088.70%
▷ Public constants54387.58%

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
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
inc/lib/smartling-connector-smartling/api-sdk-php/tests/resources/test.png10.52KB4.86KB▼ 53.81%