84% table-of-contents-block

Code Review | Table Of Contents Block

WordPress plugin Table Of Contents Block scored84%from 54 tests.

About plugin

  • Plugin page: table-of-contents...
  • Plugin version: 1.3.5
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-6.4
  • WordPress version: 6.3.1
  • First release: Oct 26, 2020
  • Latest release: Nov 21, 2023
  • Number of updates: 12
  • Update frequency: every 95.5 days
  • Top authors: wpdevteam (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

8,000+ active /54,602 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.04MB] [CPU: ▼6.19ms] Passed 4 tests

A check of server-side resources used by Table Of Contents Block
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0639.26 ▼3.05
Dashboard /wp-admin3.33 ▲0.0347.76 ▼6.94
Posts /wp-admin/edit.php3.45 ▲0.0949.07 ▲4.69
Add New Post /wp-admin/post-new.php5.94 ▲0.0680.80 ▼13.18
Media Library /wp-admin/upload.php3.25 ▲0.0236.44 ▼1.58

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Table Of Contents Block
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲5314.72 ▲0.361.87 ▲0.1443.60 ▼1.24
Dashboard /wp-admin2,186 ▲65.53 ▼0.0985.99 ▼11.0840.84 ▼3.30
Posts /wp-admin/edit.php2,100 ▼01.96 ▲0.0240.09 ▼0.8837.52 ▼9.34
Add New Post /wp-admin/post-new.php1,666 ▲14024.98 ▲1.94640.21 ▼27.6535.95 ▼14.42
Media Library /wp-admin/upload.php1,400 ▼34.19 ▲0.0193.20 ▼10.8441.97 ▼3.40

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
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for 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
The following issues need your attention
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/table-of-contents-block/includes/admin-enqueue.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/table-of-contents-block/table-of-contents-block.php:25

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 errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
6 plugin tags: gutenberg, toc, seo, schema, table of contents...

table-of-contents-block/table-of-contents-block.php Passed 13 tests

The main PHP file in "Table Of Contents Block" ver. 1.3.5 adds more information about the plugin and also serves as the entry point for this plugin
74 characters long description:
Automatically Add Table of Contents Block for your WordPress Posts & Pages

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin17,659 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
SVG501211,462
CSS61,503485,075
PHP111452051,011
JavaScript7131292
JSON30019

PHP code Passed 2 tests

This is a short overview 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.59
Average class complexity33.83
▷ Minimum class complexity1.00
▷ Maximum class complexity86.00
Average method complexity5.55
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes116.67%
Methods42
▷ Static methods1842.86%
▷ Public methods3890.48%
▷ Protected methods00.00%
▷ Private methods49.52%
Functions7
▷ Named functions114.29%
▷ Anonymous functions685.71%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There are no PNG files in this plugin