78% switch-core

Code Review | Switch Core

WordPress plugin Switch Core scored78%from 54 tests.

About plugin

  • Plugin page: switch-core
  • Plugin version: 2.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.3.0
  • WordPress version: 6.3.1
  • First release: May 2, 2018
  • Latest release: Nov 18, 2019
  • Number of updates: 14
  • Update frequency: every 40.4 days
  • Top authors: themesgrove (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /4,262 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.66MB] [CPU: ▼1.89ms] Passed 4 tests

An overview of server-side resources used by Switch Core
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.17 ▲0.7146.49 ▲6.00
Dashboard /wp-admin4.00 ▲0.6951.61 ▲0.52
Posts /wp-admin/edit.php4.05 ▲0.6953.73 ▲7.59
Add New Post /wp-admin/post-new.php6.52 ▲0.6384.96 ▼21.67
Media Library /wp-admin/upload.php3.86 ▲0.6348.53 ▲14.69
Install Plugins /wp-admin/themes.php?page=tgmpa-install-plugins3.9334.45

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 78 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Switch Core
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,215 ▲45814.30 ▼0.3522.06 ▲20.0768.13 ▲18.14
Dashboard /wp-admin2,246 ▲555.83 ▲0.95107.88 ▲1.2642.49 ▼0.02
Posts /wp-admin/edit.php2,140 ▲542.07 ▲0.0640.27 ▲4.0440.95 ▲7.90
Add New Post /wp-admin/post-new.php1,567 ▲3423.38 ▲0.46661.20 ▼4.2662.23 ▲13.74
Media Library /wp-admin/upload.php1,439 ▲544.23 ▲0.02102.41 ▼0.9646.60 ▲0.58
Install Plugins /wp-admin/themes.php?page=tgmpa-install-plugins1,0642.0523.4328.20

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 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
Please take a closer look at the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/switch-core/customizer-repeater/inc/icons.php
  • 17× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/switch-core/inc/sections-customizer.php:1793
    • > PHP Warning
      require_once(SWITCH_CORE_FILE_PATH/customizer-repeater/inc/customizer.php): failed to open stream: No such file or directory in wp-content/plugins/switch-core/customizer-repeater/functions.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/switch-core/customizer-repeater/inc/customizer.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_theme_mod() in wp-content/plugins/switch-core/inc/sections/section-testimonial.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function did_action() in wp-content/plugins/switch-core/inc/class-tgm-plugin-activation.php:2016
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_theme_mod() in wp-content/plugins/switch-core/inc/sections/section-team.php:2
    • > PHP Fatal error
      require_once(): Failed opening required 'SWITCH_CORE_FILE_PATH/customizer-repeater/inc/customizer.php' (include_path='.:/usr/share/php') in wp-content/plugins/switch-core/customizer-repeater/functions.php on line 3
    • > PHP Warning
      Use of undefined constant SWITCH_CORE_FILE_PATH - assumed 'SWITCH_CORE_FILE_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/switch-core/customizer-repeater/functions.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_theme_mod() in wp-content/plugins/switch-core/inc/sections/section-about.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Control' not found in wp-content/plugins/switch-core/customizer-repeater/class/customizer-repeater-control.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Tags: You are using too many tags: 13 tag instead of maximum 10
Please take inspiration from this readme.txt

switch-core/switch-core.php 92% from 13 tests

This is the main PHP file of "Switch Core" version 2.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 186 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
Good job! No executable or dangerous file extensions detected29,291 lines of code in 46 files:
LanguageFilesBlank linesComment linesLines of code
CSS1060916116,948
JavaScript13137356,392
PHP191,0141,8374,529
SVG3001,357
Markdown118065

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity44.67
▷ Minimum class complexity1.00
▷ Maximum class complexity195.00
Average method complexity4.51
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods112
▷ Static methods65.36%
▷ Public methods8273.21%
▷ Protected methods2320.54%
▷ Private methods76.25%
Functions12
▷ Named functions12100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants350.00%
▷ Class constants350.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
6 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon-demo.png1.92KB0.77KB▼ 59.85%
assets/images/logo.png4.13KB3.02KB▼ 26.81%
assets/images/shadow.png0.37KB0.70KB0.00%
inc/assets/images/logo.png4.13KB3.02KB▼ 26.81%
inc/assets/images/shadow.png0.37KB0.70KB0.00%