68% wptimetoread

Code Review | WPTimeToRead

WordPress plugin WPTimeToRead scored68%from 54 tests.

About plugin

  • Plugin page: wptimetoread
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-4.7
  • WordPress version: 6.3.1
  • First release: Oct 29, 2017
  • Latest release: Oct 29, 2017
  • Number of updates: 2
  • Update frequency: every 1.0 days
  • Top authors: kevindaviesnz (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /514 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▼0.22MB] [CPU: ▼16.15ms] Passed 4 tests

An overview of server-side resources used by WPTimeToRead
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0940.19 ▼1.73
Dashboard /wp-admin3.48 ▲0.1853.90 ▼1.76
Posts /wp-admin/edit.php3.45 ▲0.0948.24 ▼3.43
Add New Post /wp-admin/post-new.php4.71 ▼1.1845.39 ▼57.67
Media Library /wp-admin/upload.php3.34 ▲0.1137.37 ▼1.71

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 2,018 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
db_upgraded
recovery_mode_email_last_sent
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

WPTimeToRead: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,684 ▼10214.70 ▲0.361.10 ▼0.9625.11 ▼18.32
Dashboard /wp-admin2,207 ▲305.64 ▲0.0787.41 ▼7.3140.72 ▼6.72
Posts /wp-admin/edit.php1,228 ▼8751.51 ▼0.476.87 ▼32.9028.09 ▼7.33
Add New Post /wp-admin/post-new.php45 ▼1,4900.42 ▼18.080.10 ▼668.3012.50 ▼67.60
Media Library /wp-admin/upload.php1,401 ▼24.19 ▲0.0396.96 ▼9.1858.47 ▲10.23

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • recovery_mode_email_last_sent
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts

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
Good news, no errors were detected

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
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phpunit/phpunit/tests/TextUI/_files/phpt_external.php
    • > /wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/squizlabs/php_codesniffer/scripts/build-phar.php
  • 940× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phpunit/phpunit/tests/Framework/Constraint/ExceptionMessageTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phpunit/php-code-coverage/tests/_files/CoveragePrivateTest.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer_Sniff' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phpunit/phpunit/tests/_files/OneTestCase.php:4
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phar-io/manifest/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phar-io/manifest/examples/example-01.php on line 14
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer_Sniff' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Generic/Sniffs/Debug/JSHintSniff.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'PharIo\\Manifest\\Exception' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phar-io/manifest/src/exceptions/ManifestElementException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phpunit/php-token-stream/tests/Token/NamespaceTest.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'PHP_CodeSniffer_Sniff' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/squizlabs/php_codesniffer/CodeSniffer/Standards/Squiz/Sniffs/PHP/DisallowInlineIfSniff.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/phpunit/phpunit/tests/Regression/Trac/783/OneTest.php:7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

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
2 plugin tags: wptimetoread, reading time

wptimetoread/wptimetoread.php Passed 13 tests

The entry point to "WPTimeToRead" version 1.0.0 is a PHP file that has certain tags in its header comment area
109 characters long description:
Displays in minutes the time to read a post or page based not only on the number of words but the difficulty.

Code Analysis 3% from 3 tests

File types 0% from 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
Please fix the following items
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/squizlabs/php_codesniffer/scripts/phpcbf.bat
      • wp-content/plugins/wptimetoread/vendor/kdaviesnz/timetoread/vendor/squizlabs/php_codesniffer/scripts/phpcs.bat
125,789 lines of code in 1,826 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,45822,45943,784109,445
XML1841881375,969
Markdown821,90503,472
JSON381803,045
HTML9112361,699
Ant171250718
YAML211310528
SVG100288
XSD100269
JavaScript857146225
CSS4265101
DOS Batch222216
Bourne Shell10014

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please tend to the following items
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 270)
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity8.19
▷ Minimum class complexity1.00
▷ Maximum class complexity542.00
Average method complexity2.94
▷ Minimum method complexity1.00
▷ Maximum method complexity270.00
Code structure
Namespaces103
Interfaces89
Traits5
Classes1,392
▷ Abstract classes352.51%
▷ Concrete classes1,35797.49%
▷ Final classes775.67%
Methods5,596
▷ Static methods5429.69%
▷ Public methods4,73784.65%
▷ Protected methods4878.70%
▷ Private methods3726.65%
Functions238
▷ Named functions16167.65%
▷ Anonymous functions7732.35%
Constants189
▷ Global constants10253.97%
▷ Class constants8746.03%
▷ Public constants87100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 0.04MB with 0.02MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/kdaviesnz/timetoread/vendor/myclabs/deep-copy/doc/graph.png6.29KB3.03KB▼ 51.86%
vendor/kdaviesnz/timetoread/vendor/myclabs/deep-copy/doc/deep-copy.png10.64KB5.23KB▼ 50.84%
vendor/kdaviesnz/timetoread/vendor/myclabs/deep-copy/doc/deep-clone.png13.68KB6.54KB▼ 52.22%
vendor/kdaviesnz/timetoread/vendor/myclabs/deep-copy/doc/clone.png12.09KB5.48KB▼ 54.70%