94% pluginlyspeaking-autoswitchimage

Code Review | Autoswitch Image

WordPress plugin Autoswitch Image scored 94% from 54 tests.

About plugin

  • Plugin page: pluginlyspeaking-...
  • Plugin version: 1.2.1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-4.9
  • WordPress version: 5.9.2
  • First release: Feb 6, 2016
  • Latest release: Nov 19, 2017
  • Number of updates: 47
  • Update frequency: every 13.9 days
  • Top authors: PluginlySpeaking (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active / 1,052 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.32MB] [CPU: ▼291.76ms] Passed 4 tests

An overview of server-side resources used by Autoswitch Image
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.85 ▲0.3354.51 ▲2.40
Dashboard /wp-admin3.75 ▲0.3436.08 ▲1.69
Posts /wp-admin/edit.php3.96 ▲0.3139.53 ▼3.73
Add New Post /wp-admin/post-new.php7.27 ▲0.3094.64 ▼1,167.41
Media Library /wp-admin/upload.php3.70 ▲0.4025.74 ▲3.17
Add New /wp-admin/post-new.php?post_type=auto_s_image_ps4.2545.53
Autoswitches Image /wp-admin/edit.php?post_type=auto_s_image_ps3.7430.18

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 322 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Autoswitch Image
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,940 ▲19816.07 ▲0.329.60 ▲2.772.45 ▲0.36
Dashboard /wp-admin2,928 ▲676.16 ▲0.00120.24 ▼13.54157.50 ▼6.31
Posts /wp-admin/edit.php2,732 ▲383.26 ▲0.0264.00 ▲0.74137.79 ▼2.28
Add New Post /wp-admin/post-new.php1,699 ▲3816.38 ▼0.02458.04 ▲43.16157.32 ▲6.60
Media Library /wp-admin/upload.php1,747 ▲495.55 ▲0.01138.46 ▼13.55189.18 ▼2.66
Add New /wp-admin/post-new.php?post_type=auto_s_image_ps2,5285.6597.84157.11
Autoswitches Image /wp-admin/edit.php?post_type=auto_s_image_ps1,4233.1761.57112.86

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Uninstall script ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
The following issues need your attention
  • 12× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/example-functions.php:68
    • > PHP Warning
      require_once(/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/bootstrap.php on line 24
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/bootstrap.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/cmb-tests-base.php:10
    • > PHP Fatal error
      require_once(): Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/bootstrap.php on line 24
    • > PHP Notice
      Undefined variable: test_root in wp-content/plugins/pluginlyspeaking-autoswitchimage/cmb2/tests/bootstrap.php on line 24

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
7 plugin tags: slider, change, autoswitch, image, switch...

pluginlyspeaking-autoswitchimage/pluginlyspeaking-autoswitchimage.php Passed 13 tests

The main PHP script in "Autoswitch Image" version 1.2.1.1 is automatically included on every request by WordPress
36 characters long description:
Easily switch between a set of pics.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin88,536 lines of code in 173 files:
LanguageFilesBlank linesComment linesLines of code
XML20047,741
PO File11912,73116,32929,151
PHP221,4132,2754,900
CSS51,0221,0243,941
Sass11168231,116
JavaScript4193175856
Markdown41720487
YAML290152
JSON300121
Bourne Shell119771

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity28.76
▷ Minimum class complexity1.00
▷ Maximum class complexity121.00
Average method complexity2.79
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes21
▷ Abstract classes14.76%
▷ Concrete classes2095.24%
▷ Final classes00.00%
Methods325
▷ Static methods237.08%
▷ Public methods30995.08%
▷ Protected methods103.08%
▷ Private methods61.85%
Functions34
▷ Named functions34100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants466.67%
▷ Class constants233.33%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
15 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
cmb2/images/ui-bg_glass_75_e6e6e6_1x400.png0.11KB0.14KB0.00%
cmb2/images/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%
cmb2/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
cmb2/images/ui-icons_454545_256x240.png4.27KB4.11KB▼ 3.78%