84% nearst-for-woocommerce

Code Review | NearSt for WooCommerce

WordPress plugin NearSt for WooCommerce scored84%from 54 tests.

About plugin

  • Plugin page: nearst-for-woocom...
  • Plugin version: 1.2.4
  • PHP compatiblity: 5.7+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.4
  • WordPress version: 6.3.1
  • First release: Jul 13, 2020
  • Latest release: Nov 1, 2023
  • Number of updates: 31
  • Update frequency: every 38.9 days
  • Top authors: nearst (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,035 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: ▲1.31MB] [CPU: ▲5.61ms] Passed 4 tests

A check of server-side resources used by NearSt for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.64 ▲0.1840.10 ▲1.01
Dashboard /wp-admin5.03 ▲1.6864.72 ▲4.13
Posts /wp-admin/edit.php5.09 ▲1.7267.07 ▲16.57
Add New Post /wp-admin/post-new.php7.55 ▲1.66100.90 ▲4.07
Media Library /wp-admin/upload.php4.94 ▲1.7048.48 ▲13.24

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 350 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
nearst_auto_update_enabled
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for NearSt for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲5514.72 ▲0.512.22 ▲0.6843.89 ▲4.09
Dashboard /wp-admin2,206 ▲325.52 ▼0.14103.88 ▲16.4443.41 ▲4.12
Posts /wp-admin/edit.php2,112 ▲122.01 ▼0.0243.08 ▲1.8040.63 ▲4.34
Add New Post /wp-admin/post-new.php1,539 ▲123.42 ▲5.24675.84 ▲67.5764.78 ▼2.98
Media Library /wp-admin/upload.php1,411 ▲84.18 ▲0.0499.95 ▲3.5444.35 ▲0.69

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments
    • nearst_auto_update_enabled
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
Almost there! Just fix the following items
  • 140× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\ConditionalExpression' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Node/Expression/NullCoalesceExpression.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'Twig\odeVisitor\odeVisitorInterface' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/NodeVisitor/SandboxNodeVisitor.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\Binary\\AbstractBinary' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Node/Expression/Binary/ModBinary.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\Binary\\AbstractBinary' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Node/Expression/Binary/InBinary.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\ode' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Profiler/Node/EnterProfileNode.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\Binary\\AbstractBinary' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'Twig\\Sandbox\\SecurityPolicyInterface' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Sandbox/SecurityPolicy.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\\TokenParser\\AbstractTokenParser' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/TokenParser/IncludeTokenParser.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\Binary\\AbstractBinary' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Node/Expression/Binary/BitwiseOrBinary.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\ode' not found in wp-content/plugins/nearst-for-woocommerce/vendor/twig/twig/src/Node/ModuleNode.php:29

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)
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 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
Attributes that need to be fixed: The official readme.txt is a good inspiration

nearst-for-woocommerce/nearst-for-woocommerce.php Passed 13 tests

The entry point to "NearSt for WooCommerce" version 1.2.4 is a PHP file that has certain tags in its header comment area
44 characters long description:
Helping high street shops sell more locally.

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
Everything looks great! No dangerous files found in this plugin19,138 lines of code in 338 files:
LanguageFilesBlank linesComment linesLines of code
PHP2032,8454,45515,102
reStructuredText1132,4132,3452,912
JSON500391
YAML35033200
HTML560159
CSS1250135
make1245124
Bourne Shell16143
Python17316533
Markdown28017
SVG20014
JavaScript1008

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity8.80
▷ Minimum class complexity1.00
▷ Maximum class complexity153.00
Average method complexity2.67
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces27
Interfaces11
Traits0
Classes177
▷ Abstract classes116.21%
▷ Concrete classes16693.79%
▷ Final classes5734.34%
Methods893
▷ Static methods9310.41%
▷ Public methods77186.34%
▷ Protected methods495.49%
▷ Private methods738.17%
Functions130
▷ Named functions11084.62%
▷ Anonymous functions2015.38%
Constants52
▷ Global constants47.69%
▷ Class constants4892.31%
▷ Public constants48100.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
No PNG files were detected