72% qs-dark-mode

Code Review | QS Dark Mode Plugin

WordPress plugin QS Dark Mode Plugin scored72%from 54 tests.

About plugin

  • Plugin page: qs-dark-mode
  • Plugin version: 2.8
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.1
  • WordPress version: 6.3.1
  • First release: Sep 27, 2021
  • Latest release: Nov 10, 2022
  • Number of updates: 29
  • Update frequency: every 14.1 days
  • Top authors: quomodosoft (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

1,000+ active /15,587 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.08MB] [CPU: ▼3.69ms] Passed 4 tests

Analyzing server-side resources used by QS Dark Mode Plugin
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0744.17 ▼3.04
Dashboard /wp-admin3.38 ▲0.0751.10 ▲2.77
Posts /wp-admin/edit.php3.49 ▲0.1351.58 ▼4.72
Add New Post /wp-admin/post-new.php5.99 ▲0.1090.16 ▼9.77
Media Library /wp-admin/upload.php3.30 ▲0.0742.47 ▲5.24
Dark Mode /wp-admin/admin.php?page=qs-dark-mode3.4646.11

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 125 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by QS Dark Mode Plugin
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,868 ▲12213.27 ▼1.121.75 ▼0.6744.42 ▼1.46
Dashboard /wp-admin2,248 ▲604.88 ▼1.03108.59 ▲3.7886.03 ▲44.34
Posts /wp-admin/edit.php2,146 ▲572.07 ▲0.0135.67 ▼5.6838.91 ▲2.52
Add New Post /wp-admin/post-new.php6,418 ▲4,87427.87 ▲9.33877.93 ▲229.2436.27 ▼20.04
Media Library /wp-admin/upload.php1,445 ▲574.25 ▲0.1096.40 ▼14.3272.74 ▲26.45
Dark Mode /wp-admin/admin.php?page=qs-dark-mode5,5634.95156.10102.87

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/qs-dark-mode/qs-dark-mode.php
  • 24× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/qs-dark-mode/app/Pages/views/option-part/images.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/qs-dark-mode/app/Base/views/presets/style2.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/qs-dark-mode/app/Utilities/Inc/Hooks.php:4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/qs-dark-mode/app/Pages/views/option-part/color-preset.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/qs-dark-mode/app/Pages/views/dashboard.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/qs-dark-mode/app/Base/views/presets/style1.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'QSDarkMode\\Base\\BaseController' not found in wp-content/plugins/qs-dark-mode/app/Base/SettingsLinks.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/qs-dark-mode/app/Pages/options/custom_element.php:4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/qs-dark-mode/app/Pages/views/option-part/advanced.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/qs-dark-mode/app/Pages/options/advanced.php:13

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 724 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 736 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 748 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 786 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 798 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 961 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 974 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 987 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 1000 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 1013 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 1026 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=qs-dark-mode
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=qs-dark-mode 1039 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Screenshots: These screenshots need descriptions #1, #2, #3, #4, #5, #6, #7, #8 in qs-dark-mode/assets to your readme.txt
Please take inspiration from this readme.txt

qs-dark-mode/qs-dark-mode.php 92% from 13 tests

The entry point to "QS Dark Mode Plugin" version 2.8 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Requires at least: The required version number did not match the one declared in readme.txt ("5.5" instead of "5.0")

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
Good job! No executable or dangerous file extensions detected19,424 lines of code in 99 files:
LanguageFilesBlank linesComment linesLines of code
CSS103,1646713,448
PHP531,2343553,831
JavaScript134491361,657
SVG1601213
JSON410184
Sass36091

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity11.65
▷ Minimum class complexity1.00
▷ Maximum class complexity47.00
Average method complexity3.20
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces7
Interfaces0
Traits7
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes17.69%
Methods98
▷ Static methods2626.53%
▷ Public methods9596.94%
▷ Protected methods00.00%
▷ Private methods33.06%
Functions56
▷ Named functions5496.43%
▷ Anonymous functions23.57%
Constants11
▷ Global constants11100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
21 PNG files occupy 0.16MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/presets/style8.png16.05KB7.18KB▼ 55.27%
assets/img/switchs/style2.png0.91KB0.54KB▼ 40.04%
assets/img/switchs/style9.png0.82KB0.59KB▼ 28.11%
assets/img/icon.png0.31KB0.28KB▼ 9.49%
(invalid) assets/img/switchs/style1.png2.01KB0.00KB▼ 100.00%