83% wp-image-color-palette

Code Review | WP Image Color Palette

WordPress plugin WP Image Color Palette scored83%from 54 tests.

About plugin

  • Plugin page: wp-image-color-pa...
  • Plugin version: 1.4.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-4.8
  • WordPress version: 6.3.1
  • First release: Jul 6, 2017
  • Latest release: Aug 14, 2017
  • Number of updates: 11
  • Update frequency: every 3.6 days
  • Top authors: mkronenfeld (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /943 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.09MB] [CPU: ▼2.47ms] Passed 4 tests

This is a short check of server-side resources used by WP Image Color Palette
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0538.63 ▼2.79
Dashboard /wp-admin3.41 ▲0.1151.16 ▲2.35
Posts /wp-admin/edit.php3.53 ▲0.1751.26 ▲1.07
Add New Post /wp-admin/post-new.php5.99 ▲0.1186.64 ▼10.51
Media Library /wp-admin/upload.php3.33 ▲0.1139.14 ▲2.63
Image Color Palette /wp-admin/tools.php?page=wpip-settings3.3134.71

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

Analyzing filesystem and database footprints of this plugin
Please fix the following
  • There were 1 file (4.00KB) illegally modified outside of "wp-content/plugins/wp-image-color-palette/" and "wp-content/uploads/"
    • (new file) wp-content/mgd_mirror/mgd_maximinodotpy-gitdown-test-repository
Filesystem: 42 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for WP Image Color Palette
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,819 ▲4813.28 ▼1.144.48 ▲2.3838.64 ▼8.27
Dashboard /wp-admin2,228 ▲255.85 ▲0.0496.57 ▼13.7339.44 ▼3.21
Posts /wp-admin/edit.php2,114 ▲142.06 ▲0.0339.29 ▲2.7138.03 ▲1.04
Add New Post /wp-admin/post-new.php1,548 ▲1723.38 ▼0.05665.67 ▲0.9959.41 ▲7.92
Media Library /wp-admin/upload.php1,407 ▲44.16 ▼0.0596.78 ▼5.3447.44 ▲3.39
Image Color Palette /wp-admin/tools.php?page=wpip-settings9142.0524.5430.71

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
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% 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)
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 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
Please take a closer look at the following
  • 7× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/wp-image-color-palette/admin/partials/wpip-field-select.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wpip_is_config_valid() in wp-content/plugins/wp-image-color-palette/admin/partials/wpip-admin-page-settings.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wp-image-color-palette/vendor/image-palette/tests/ImagePaletteTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Makro\\ImagePalette\\Validator' not found in wp-content/plugins/wp-image-color-palette/public/class-wpip-validator.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/wp-image-color-palette/vendor/image-palette/tests/ColorMappingTest.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/wp-image-color-palette/admin/partials/wpip-field-number.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Makro\\ImagePalette\\Exception\\Exception' not found in wp-content/plugins/wp-image-color-palette/vendor/image-palette/src/Exception/UnsupportedFileTypeException.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that require attention:
  • Tags: You are using too many tags: 13 tag instead of maximum 10
You can take inspiration from this readme.txt

wp-image-color-palette/wpip.php 77% from 13 tests

The main PHP script in "WP Image Color Palette" version 1.4.0 is automatically included on every request by WordPress
It is important to fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Domain Path: The domain path is invalid: folder "/languages" does not exist
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("wp-image-color-palette.php" instead of "wpip.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin1,376 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
PHP262751,0561,088
JSON200183
Markdown341087
XML10018

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity4.44
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity1.76
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces2
Interfaces1
Traits0
Classes17
▷ Abstract classes00.00%
▷ Concrete classes17100.00%
▷ Final classes00.00%
Methods84
▷ Static methods22.38%
▷ Public methods5767.86%
▷ Protected methods1720.24%
▷ Private methods1011.90%
Functions12
▷ Named functions1083.33%
▷ Anonymous functions216.67%
Constants12
▷ Global constants1191.67%
▷ Class constants18.33%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
vendor/image-palette/tests/logo11w.png13.69KB8.97KB▼ 34.47%