100% dark-mode-toggle

Code Review | Dark Mode Toggle

WordPress plugin Dark Mode Toggle scored 100% from 54 tests.

About plugin

  • Plugin page: dark-mode-toggle
  • Plugin version: 1.0.5
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-5.9
  • WordPress version: 5.9.2
  • First release: Feb 22, 2022
  • Latest release: Mar 23, 2022
  • Number of updates: 7
  • Update frequency: every 4.1 days
  • Top authors: scriptstown (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active / 1,496 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.19MB] [CPU: ▼303.28ms] Passed 4 tests

Analyzing server-side resources used by Dark Mode Toggle
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2056.15 ▼0.77
Dashboard /wp-admin3.61 ▲0.2138.09 ▲1.78
Posts /wp-admin/edit.php3.84 ▲0.2043.84 ▲2.48
Add New Post /wp-admin/post-new.php7.14 ▲0.1794.69 ▼1,209.33
Media Library /wp-admin/upload.php3.56 ▲0.2725.58 ▼4.78
Dark Mode /wp-admin/themes.php?page=darkmodetg-settings3.6826.97

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 38 new files
Database: no new tables, no new options

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 /3,857 ▲13515.97 ▲0.418.26 ▲1.789.26 ▲6.61
Dashboard /wp-admin2,897 ▲366.14 ▼0.10115.31 ▼25.11155.35 ▼5.38
Posts /wp-admin/edit.php2,693 ▲53.24 ▲0.0062.03 ▼11.20134.68 ▼4.86
Add New Post /wp-admin/post-new.php1,664 ▼5315.79 ▼5.54399.74 ▼44.69149.21 ▼7.89
Media Library /wp-admin/upload.php1,703 ▲55.52 ▼0.01142.04 ▼7.74186.30 ▼1.26
Dark Mode /wp-admin/themes.php?page=darkmodetg-settings2,9543.9991.76197.81

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Uninstall script ran successfully

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

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

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: toggle, dark, night mode, dark theme, dark mode

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

The entry point to "Dark Mode Toggle" version 1.0.5 is a PHP file that has certain tags in its header comment area
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 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin1,582 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
PHP273325581,265
JavaScript5630315
CSS2002

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity8.50
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.62
▷ 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

PNG files should be compressed to save space and minimize bandwidth usage
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%