84% easy-table-of-contents

Code Review | Easy Table of Contents

WordPress plugin Easy Table of Contents scored84%from 54 tests.

About plugin

  • Plugin page: easy-table-of-con...
  • Plugin version: 2.0.59
  • PHP compatiblity: 5.6.20+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Sep 9, 2015
  • Latest release: Nov 29, 2023
  • Number of updates: 276
  • Update frequency: every 10.9 days
  • Top authors: magazine3 (52.17%)shazahm1@hotmail.com (48.19%)

Code review

54 tests

User reviews

178 reviews

Install metrics

500,000+ active /10,407,767 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲1.43MB] [CPU: ▲5.48ms] Passed 4 tests

Server-side resources used by Easy Table of Contents
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.64 ▲1.1843.63 ▼1.03
Dashboard /wp-admin4.80 ▲1.5053.01 ▲0.56
Posts /wp-admin/edit.php4.92 ▲1.5660.47 ▲11.34
Add New Post /wp-admin/post-new.php7.85 ▲1.96107.39 ▲11.04
Media Library /wp-admin/upload.php4.73 ▲1.5050.74 ▲14.98
Table of Contents /wp-admin/options-general.php?page=table-of-contents5.0348.48

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 55 new files
Database: no new tables, 9 new options
New WordPress options
ez-toc-settings
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
widget_ez_toc_widget_sticky
widget_ezw_tco

Browser metrics Passed 4 tests

Easy Table of Contents: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,831 ▲6914.37 ▲0.141.62 ▼0.2041.41 ▼6.48
Dashboard /wp-admin2,233 ▲535.02 ▼0.6599.18 ▼13.5444.43 ▲1.35
Posts /wp-admin/edit.php2,143 ▲402.55 ▲0.5747.17 ▲2.0135.56 ▼2.06
Add New Post /wp-admin/post-new.php1,772 ▲24623.18 ▲0.19750.34 ▲84.6751.46 ▼1.61
Media Library /wp-admin/upload.php1,438 ▲384.57 ▲0.38109.86 ▲12.0647.47 ▲7.71
Table of Contents /wp-admin/options-general.php?page=table-of-contents4,7753.23141.7294.41

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 9 options
    • theysaidso_admin_options
    • ez-toc-settings
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_ezw_tco
    • widget_recent-comments
    • db_upgraded
    • widget_ez_toc_widget_sticky

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 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_get_current_user() in wp-content/plugins/easy-table-of-contents/includes/deactivate-feedback.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/easy-table-of-contents/includes/inc.plugin-compatibility.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Error' not found in wp-content/plugins/easy-table-of-contents/includes/Debug.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/easy-table-of-contents/includes/inc.admin-options-page.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 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
Attributes that need to be fixed: You can take inspiration from this readme.txt

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

Analyzing the main PHP file in "Easy Table of Contents" version 2.0.59
119 characters long description:
Adds a user friendly and fully automatic way to create and display a table of contents generated from the page content.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin15,552 lines of code in 44 files:
LanguageFilesBlank linesComment linesLines of code
PHP162,6302,50211,844
CSS11395202,124
JavaScript151831281,199
PO File1129123378
XML1007

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
It is recommended to fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 262)
Cyclomatic complexity
Average complexity per logical line of code0.68
Average class complexity157.53
▷ Minimum class complexity2.00
▷ Maximum class complexity384.00
Average method complexity9.91
▷ Minimum method complexity1.00
▷ Maximum method complexity262.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes19
▷ Abstract classes00.00%
▷ Concrete classes19100.00%
▷ Final classes421.05%
Methods335
▷ Static methods12035.82%
▷ Public methods27882.99%
▷ Protected methods51.49%
▷ Private methods5215.52%
Functions87
▷ Named functions6068.97%
▷ Anonymous functions2731.03%
Constants6
▷ Global constants466.67%
▷ Class constants233.33%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
4 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/toc-rating.png1.20KB1.25KB0.00%
assets/offer-gift-icon.png19.62KB7.99KB▼ 59.26%
assets/eztoc-logo.png5.04KB5.03KB0.21%
assets/right-tick.png1.88KB0.71KB▼ 62.23%