94% bainternet-simple-toc

Code Review | Simple TOC

WordPress plugin Simple TOC scored 94% from 53 tests.

About plugin

  • Plugin page: bainternet-simple...
  • Plugin version: 0.9.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.0-4.7.0
  • WordPress version: 5.8.1
  • First release: May 6, 2011
  • Latest release: Dec 11, 2016
  • Number of updates: 22
  • Update frequency: every 93.2 days
  • Top authors: bainternet (100%)

Code review

53 tests

User reviews

3 reviews

Install metrics

500+ active / 14,546 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼276.47ms] Passed 4 tests

Analyzing server-side resources used by Simple TOC
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.1225.08 ▲8.42
Dashboard /wp-admin3.07 ▲0.0146.52 ▲4.38
Posts /wp-admin/edit.php3.12 ▲0.0139.85 ▼4.25
Add New Post /wp-admin/post-new.php5.43 ▲0.0093.74 ▼1,097.24
Media Library /wp-admin/upload.php3.01 ▲0.0030.68 ▼8.77

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 6 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Simple TOC
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,675 ▲9315.85 ▲0.238.19 ▼1.0246.32 ▲1.49
Dashboard /wp-admin2,951 ▲1016.01 ▲0.13134.71 ▼14.32105.30 ▲2.91
Posts /wp-admin/edit.php2,705 ▼12.70 ▲0.0260.76 ▼10.6688.92 ▼1.48
Add New Post /wp-admin/post-new.php1,481 ▼37617.13 ▼2.04333.93 ▼36.79109.55 ▲1.27
Media Library /wp-admin/upload.php1,774 ▲25.01 ▲0.03147.81 ▼2.40110.64 ▼2.46

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not 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
  • 1× 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/bainternet-simple-toc/simple-toc.php:35

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
3 plugin tags: toc, wiki like toc, table of contents

bainternet-simple-toc/simple-toc.php 92% from 13 tests

The primary PHP file in "Simple TOC" version 0.9.0 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("bainternet-simple-toc.php" instead of "simple-toc.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Good job! No executable or dangerous file extensions detected296 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP12129165
JavaScript100128
CSS1003

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.13
Average class complexity15.00
▷ Minimum class complexity15.00
▷ Maximum class complexity15.00
Average method complexity2.40
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods10100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 1 test

Image compression Passed 1 test

Using a strong compression for your PNG files is a great way to speed-up your plugin
2 PNG files occupy 0.14MB with 0.06MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
toc.png137.58KB87.32KB▼ 36.53%
assets/images/toc_icon.png4.57KB2.44KB▼ 46.69%