68% wp-tocjs

Code Review | WP TocJS

WordPress plugin WP TocJS scored68%from 54 tests.

About plugin

  • Plugin page: wp-tocjs
  • Plugin version: 0.4.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-4.9.8
  • WordPress version: 6.3.1
  • First release: Mar 7, 2018
  • Latest release: Dec 3, 2018
  • Number of updates: 16
  • Update frequency: every 16.9 days
  • Top authors: ejointjp (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /989 total downloads

Benchmarks

Plugin footprint 65% 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.89MB] [CPU: ▼37.10ms] Passed 4 tests

A check of server-side resources used by WP TocJS
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0525.89 ▼15.90
Dashboard /wp-admin3.06 ▼0.2926.05 ▼31.28
Posts /wp-admin/edit.php3.06 ▼0.3024.10 ▼21.99
Add New Post /wp-admin/post-new.php3.06 ▼2.8324.24 ▼79.24
Media Library /wp-admin/upload.php3.06 ▼0.1723.06 ▼11.09
WP TocJS /wp-admin/options-general.php?page=wptjs-setting3.0623.10

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP TocJS
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,879 ▲13313.40 ▼1.318.14 ▲6.4845.55 ▲2.18
Dashboard /wp-admin2,199 ▲225.62 ▼0.0488.66 ▼1.3139.31 ▼1.76
Posts /wp-admin/edit.php2,101 ▲12.04 ▲0.0436.34 ▼1.7233.75 ▲0.53
Add New Post /wp-admin/post-new.php6,221 ▲4,69626.09 ▲2.94845.58 ▲245.6052.42 ▼52.40
Media Library /wp-admin/upload.php1,404 ▲44.22 ▲0.04100.70 ▲6.0643.81 ▼1.32
WP TocJS /wp-admin/options-general.php?page=wptjs-setting9302.1323.6032.10

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/wp-tocjs/wp-tocjs.php+326
    Trying to access array offset on value of type bool
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wptjs-setting
    • > Notice in wp-content/plugins/wp-tocjs/wp-tocjs.php+280
    Trying to access array offset on value of type bool

SRP 50% 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
Almost there! Just fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_file_data() in wp-content/plugins/wp-tocjs/wp-tocjs.php:75

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Please fix the following attributes:
  • Donate link: Invalid URI found ("")
  • Screenshots: Screenshot #1 (Quotation sample.) image required
Please take inspiration from this readme.txt

wp-tocjs/wp-tocjs.php Passed 13 tests

"WP TocJS" version 0.4.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
62 characters long description:
A WordPress plugin that makes Table of Contents automatically.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected459 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP27837343
PO File1313883
Sass19031
CSS1001
JavaScript1001

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity34.00
▷ Minimum class complexity34.00
▷ Maximum class complexity34.00
Average method complexity2.14
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods29
▷ Static methods00.00%
▷ Public methods2482.76%
▷ Protected methods26.90%
▷ Private methods310.34%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.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 are no PNG files in this plugin