83% dark-mode-lite

Code Review | Dark Mode Lite

WordPress plugin Dark Mode Lite scored 83% from 54 tests.

About plugin

  • Plugin page: dark-mode-lite
  • Plugin version: 1.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.6
  • WordPress version: 5.9.2
  • First release: Jan 22, 2021
  • Latest release: Jan 22, 2021
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: frsarker (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 748 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼297.48ms] Passed 4 tests

Analyzing server-side resources used by Dark Mode Lite
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0256.50 ▲1.51
Dashboard /wp-admin3.44 ▲0.0336.53 ▲0.80
Posts /wp-admin/edit.php3.66 ▲0.0242.15 ▲1.83
Add New Post /wp-admin/post-new.php6.90 ▼0.0795.19 ▼1,192.67
Media Library /wp-admin/upload.php3.32 ▲0.0229.79 ▲0.46
Dark Mode Lite /wp-admin/options-general.php?page=dml-index3.3723.82

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 26 new files
Database: no new tables, 6 new options
New WordPress options
dml_display_dark_mode_visitor
dml_low_image_brightness
dml_floating_switch_position
dml_image_brightness_level
dml_display_dark_mode_admin
dml_dark_mode_by_default

Browser metrics Passed 4 tests

An overview of browser requirements for Dark Mode Lite
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,898 ▲15616.55 ▲0.9012.19 ▲6.172.37 ▲0.17
Dashboard /wp-admin2,859 ▲16.68 ▲0.46123.23 ▼8.12191.71 ▲22.73
Posts /wp-admin/edit.php2,683 ▼83.31 ▲0.0769.40 ▲6.21188.69 ▲43.36
Add New Post /wp-admin/post-new.php1,778 ▲2624.36 ▲2.43402.03 ▼36.96147.25 ▼10.30
Media Library /wp-admin/upload.php1,690 ▼115.85 ▲0.31132.66 ▼14.37217.16 ▲24.99
Dark Mode Lite /wp-admin/options-general.php?page=dml-index1,5763.0867.20164.27

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • dml_floating_switch_position
    • dml_display_dark_mode_admin
    • dml_dark_mode_by_default
    • dml_display_dark_mode_visitor
    • dml_low_image_brightness
    • dml_image_brightness_level

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
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 6× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/dark-mode-lite/views/main-container.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/dark-mode-lite/index.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/dark-mode-lite/includes/save_advanced.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/dark-mode-lite/includes/get_settings.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/dark-mode-lite/includes/save_general.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/dark-mode-lite/includes/save_style.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention:
  • Donate link: Invalid url: ""
You can take inspiration from this readme.txt

dark-mode-lite/index.php 77% from 13 tests

The main file in "Dark Mode Lite" v. 1.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Text Domain: Please use dashes and lowercase characters for text domains
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("dark-mode-lite.php" instead of "index.php")
  • Description: The description should be shorter than 140 characters (currently 209 characters long)

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
Everything looks great! No dangerous files found in this plugin16,325 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
CSS51,2861679,864
JavaScript58593203,428
SVG1002,671
PHP711934362

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
styles/images/logo_menu.png1.56KB0.35KB▼ 77.82%