83% rich-table-of-content

Code Review | Rich Table of Contents

WordPress plugin Rich Table of Contents scored83%from 54 tests.

About plugin

  • Plugin page: rich-table-of-con...
  • Plugin version: 1.3.99
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Feb 25, 2020
  • Latest release: Jul 13, 2023
  • Number of updates: 136
  • Update frequency: every 9.1 days
  • Top authors: ryota0101 (100%)

Code review

54 tests

User reviews

17 reviews

Install metrics

30,000+ active /292,410 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.01MB] [CPU: ▲6.29ms] Passed 4 tests

Server-side resources used by Rich Table of Contents
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.49 ▲1.0357.87 ▲12.85
Dashboard /wp-admin4.35 ▲1.0554.44 ▲7.12
Posts /wp-admin/edit.php4.40 ▲1.0554.73 ▲1.85
Add New Post /wp-admin/post-new.php6.87 ▲0.98102.38 ▲4.86
Media Library /wp-admin/upload.php4.21 ▲0.9845.11 ▲11.32

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 56 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
rtoc_category_added
rtoc_display
widget_theysaidso_widget
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

Rich Table of Contents: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,923 ▲17713.61 ▼0.695.71 ▲3.8142.09 ▼4.08
Dashboard /wp-admin2,221 ▲395.00 ▲0.12105.72 ▲1.0740.02 ▼5.11
Posts /wp-admin/edit.php2,101 ▲92.06 ▲0.0937.37 ▼13.2033.29 ▼3.34
Add New Post /wp-admin/post-new.php1,529 ▲923.41 ▲0.23638.62 ▼20.4076.41 ▲25.78
Media Library /wp-admin/upload.php1,400 ▲94.17 ▼0.05103.71 ▲1.2442.67 ▲0.15

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
Please fix the following items
  • The uninstall procedure has failed, leaving 8 options in the database
    • rtoc_category_added
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • rtoc_display

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

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
Please fix the following
  • 5× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rich-table-of-content/include/rtoc_admin.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rich-table-of-content/include/rtoc_edit.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rich-table-of-content/include/rtoc_inline.php:150
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rich-table-of-content/include/rtoc_userate.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/rich-table-of-content/include/rtoc_shortcode.php:2050

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 81% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Tested up to: Version not formatted correctly
  • Requires at least: Version not formatted correctly
  • Requires php: Version not formatted correctly
The official readme.txt might help

rich-table-of-content/functions.php 92% from 13 tests

Analyzing the main PHP file in "Rich Table of Contents" version 1.3.99
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("rich-table-of-content.php" instead of "functions.php")

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
There were no executable files found in this plugin10,129 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP63223246,358
CSS773102,311
JavaScript97751969
PO File1166202471
SVG20020

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.58
Average class complexity59.00
▷ Minimum class complexity49.00
▷ Maximum class complexity69.00
Average method complexity7.11
▷ Minimum method complexity1.00
▷ Maximum method complexity29.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods19
▷ Static methods421.05%
▷ Public methods19100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions74
▷ Named functions7398.65%
▷ Anonymous functions11.35%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
28 PNG files occupy 0.35MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/jin/preset6.png3.25KB1.36KB▼ 58.13%
img/plus.png0.21KB0.14KB▼ 32.38%
img/design4.png4.08KB1.83KB▼ 55.28%
img/jin/preset2.png2.95KB1.18KB▼ 59.90%
img/question.png5.66KB2.61KB▼ 53.90%