78% catch-dark-mode

Code Review | Catch Dark Mode

WordPress plugin Catch Dark Mode scored78%from 54 tests.

About plugin

  • Plugin page: catch-dark-mode
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 5.7-6.4
  • WordPress version: 6.3.1
  • First release: Jun 14, 2021
  • Latest release: Nov 15, 2023
  • Number of updates: 8
  • Update frequency: every 111.0 days
  • Top authors: catchthemes (75%)maheshmaharjan (37.5%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /4,208 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 gracefully, with no errors

Server metrics [RAM: ▲0.16MB] [CPU: ▼5.46ms] Passed 4 tests

A check of server-side resources used by Catch Dark Mode
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.66 ▲0.1942.14 ▲2.76
Dashboard /wp-admin3.47 ▲0.1246.09 ▼14.52
Posts /wp-admin/edit.php3.58 ▲0.2350.22 ▲7.19
Add New Post /wp-admin/post-new.php6.05 ▲0.1683.95 ▼10.10
Media Library /wp-admin/upload.php3.39 ▲0.1632.88 ▲0.02

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 81 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Catch Dark Mode
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,121 ▲34913.44 ▼0.8410.25 ▲8.3446.55 ▲2.50
Dashboard /wp-admin2,284 ▲1105.52 ▲0.0090.20 ▼2.1477.51 ▲32.65
Posts /wp-admin/edit.php2,189 ▲891.97 ▲0.0036.01 ▼4.4133.44 ▼8.82
Add New Post /wp-admin/post-new.php1,772 ▲24623.27 ▲0.05720.98 ▲64.2853.00 ▼3.22
Media Library /wp-admin/upload.php1,489 ▲894.22 ▲0.0196.97 ▼5.8663.78 ▲20.87

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 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
Please fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/catch-dark-mode/plugin.php
  • 14× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/catch-dark-mode/templates/switch-style/style-8.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/catch-dark-mode/admin/partials/dashboard.php:19
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/catch-dark-mode/templates/switch-style/style-1.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/catch-dark-mode/includes/jetpack-compatibility.php:4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/catch-dark-mode/templates/switch-style/style-2.php:2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/catch-dark-mode/templates/switch-style/style-5.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/catch-dark-mode/admin/partials/sidebar.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/catch-dark-mode/admin/partials/footer.php:4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/catch-dark-mode/templates/switch-style/style-7.php:2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/catch-dark-mode/includes/dynamic.css.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
4 plugin tags: dark, mode, color, css

catch-dark-mode/plugin.php 85% from 13 tests

The primary PHP file in "Catch Dark Mode" version 1.2 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("catch-dark-mode.php" instead of "plugin.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 254 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
No dangerous file extensions were detected3,794 lines of code in 52 files:
LanguageFilesBlank linesComment linesLines of code
PHP253167751,690
CSS3233391,595
JavaScript684159295
SVG1804214

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity8.00
▷ Minimum class complexity1.00
▷ Maximum class complexity27.00
Average method complexity2.06
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes112.50%
Methods52
▷ Static methods35.77%
▷ Public methods4586.54%
▷ Protected methods00.00%
▷ Private methods713.46%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants8
▷ Global constants8100.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
15 PNG files occupy 0.22MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/css/light.png11.72KB5.39KB▼ 53.99%
image/button/style-8.png6.64KB2.21KB▼ 66.69%
admin/images/free-plugin-246x116.png8.01KB3.81KB▼ 52.42%
image/button/style-5.png8.03KB3.19KB▼ 60.35%
image/button/style-1.png6.94KB3.40KB▼ 51.04%