89% wmf-mobile-theme-switcher

Code Review | WMF Theme Switcher

WordPress plugin WMF Theme Switcher scored89%from 54 tests.

About plugin

  • Plugin page: wmf-mobile-theme-...
  • Plugin version: 1.0.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.4.1
  • WordPress version: 6.3.1
  • First release: May 19, 2020
  • Latest release: Jul 12, 2020
  • Number of updates: 40
  • Update frequency: every 1.4 days
  • Top authors: webbu (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /535 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.43MB] [CPU: ▼1.09ms] Passed 4 tests

An overview of server-side resources used by WMF Theme Switcher
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.90 ▲0.4446.40 ▲2.33
Dashboard /wp-admin3.78 ▲0.4454.76 ▼9.69
Posts /wp-admin/edit.php3.84 ▲0.4851.81 ▼0.34
Add New Post /wp-admin/post-new.php6.32 ▲0.4499.21 ▲3.95
Media Library /wp-admin/upload.php3.65 ▲0.4241.68 ▲3.33
WMF Theme Switcher /wp-admin/options-general.php?page=wmf-mobile-theme-switcher/wmf-theme-switcher.php3.6241.13

Server storage [IO: ▲0.25MB] [DB: ▲0.00MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • The plugin illegally modified 1 file (96.05KB) outside of "wp-content/plugins/wmf-mobile-theme-switcher/" and "wp-content/uploads/"
    • (new file) wp-content/mu-plugins/wmf-theme-switcher-mu.php
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for WMF Theme Switcher
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,798 ▲3714.72 ▲0.371.78 ▼0.4444.88 ▲1.67
Dashboard /wp-admin2,204 ▲365.64 ▲0.1085.74 ▼8.7937.71 ▼2.04
Posts /wp-admin/edit.php2,109 ▲91.98 ▼0.0634.84 ▼3.7637.92 ▲1.38
Add New Post /wp-admin/post-new.php1,536 ▲123.24 ▲5.05608.86 ▼25.5165.85 ▲3.49
Media Library /wp-admin/upload.php1,409 ▲94.24 ▲0.0796.34 ▼7.0642.90 ▼2.10
WMF Theme Switcher /wp-admin/options-general.php?page=wmf-mobile-theme-switcher/wmf-theme-switcher.php1,3531.8229.9636.65

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP Passed 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
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 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
6 plugin tags: mobile theme switcher, webbu, mobile detect, mobile browser detect, theme switcher...

wmf-mobile-theme-switcher/wmf-theme-switcher.php 92% from 13 tests

"WMF Theme Switcher" version 1.0.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("wmf-mobile-theme-switcher.php" instead of "wmf-theme-switcher.php")

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
Success! There were no dangerous files found in this plugin2,517 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP44071,3221,776
JavaScript48820477
CSS13312264

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.78
Average class complexity89.75
▷ Minimum class complexity27.00
▷ Maximum class complexity134.00
Average method complexity4.90
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods91
▷ Static methods1819.78%
▷ Public methods8492.31%
▷ Protected methods44.40%
▷ Private methods33.30%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants23
▷ Global constants521.74%
▷ Class constants1878.26%
▷ Public constants18100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
2 compressed PNG files occupy 0.00MB
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/switch.png0.53KB0.64KB0.00%
images/copy.png0.78KB0.87KB0.00%