90% dark-mode-toggle

Code Review | Dark Mode Toggle

WordPress plugin Dark Mode Toggle scored90%from 54 tests.

About plugin

  • Plugin page: dark-mode-toggle
  • Plugin version: 1.3.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4
  • WordPress version: 6.3.1
  • First release: Feb 22, 2022
  • Latest release: Nov 23, 2023
  • Number of updates: 33
  • Update frequency: every 19.4 days
  • Top authors: scriptstown (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

2,000+ active /51,669 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.21MB] [CPU: ▼4.20ms] Passed 4 tests

Analyzing server-side resources used by Dark Mode Toggle
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2036.29 ▼7.83
Dashboard /wp-admin3.58 ▲0.2344.48 ▼13.27
Posts /wp-admin/edit.php3.63 ▲0.2750.04 ▲2.53
Add New Post /wp-admin/post-new.php6.10 ▲0.2198.17 ▲7.21
Media Library /wp-admin/upload.php3.44 ▲0.2139.34 ▲1.77
Dark Mode /wp-admin/themes.php?page=darkmodetg-settings3.4833.75

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 40 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Dark Mode Toggle
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,863 ▲10114.76 ▲0.644.27 ▲2.6254.31 ▲12.12
Dashboard /wp-admin2,196 ▲165.58 ▼0.0892.57 ▼7.4238.31 ▼3.35
Posts /wp-admin/edit.php2,104 ▲12.01 ▲0.0738.20 ▼2.9133.13 ▼0.32
Add New Post /wp-admin/post-new.php1,529 ▲323.14 ▼0.14650.30 ▼28.9656.32 ▼2.61
Media Library /wp-admin/upload.php1,404 ▲44.20 ▲0.0296.03 ▼13.5540.81 ▼3.35
Dark Mode /wp-admin/themes.php?page=darkmodetg-settings2,3782.8868.5798.94

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP Passed 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
The SRP test was a success

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: dark theme, toggle, dark, night mode, dark mode

dark-mode-toggle/dark-mode-toggle.php Passed 13 tests

"Dark Mode Toggle" version 1.3.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
128 characters long description:
Bring dark mode toggle switch to your WordPress website. A simple switch to turn on and off the dark mode. Fast and easy to use.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected4,834 lines of code in 36 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript7154623,518
PHP273415591,314
CSS2002

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity8.86
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.69
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces3
Interfaces1
Traits2
Classes11
▷ Abstract classes19.09%
▷ Concrete classes1090.91%
▷ Final classes00.00%
Methods67
▷ Static methods811.94%
▷ Public methods6698.51%
▷ Protected methods00.00%
▷ Private methods11.49%
Functions5
▷ Named functions480.00%
▷ Anonymous functions120.00%
Constants4
▷ Global constants4100.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
1 compressed PNG file occupies 0.02MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/Dark-Mode-Toggle-Pro.png18.92KB19.68KB0.00%