84% dominant-color

Code Review | Dominant Color

WordPress plugin Dominant Color scored84%from 54 tests.

About plugin

  • Plugin page: dominant-color
  • Plugin version: 2.2.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4-5.9.1
  • WordPress version: 6.3.1
  • First release: Jul 21, 2015
  • Latest release: Mar 13, 2022
  • Number of updates: 20
  • Update frequency: every 121.4 days
  • Top authors: lgladdy (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

300+ active /4,663 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.07MB] [CPU: ▼10.54ms] Passed 4 tests

A check of server-side resources used by Dominant Color
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0834.37 ▼6.99
Dashboard /wp-admin3.38 ▲0.0444.80 ▼14.95
Posts /wp-admin/edit.php3.49 ▲0.1446.03 ▲0.33
Add New Post /wp-admin/post-new.php5.98 ▲0.1088.35 ▼20.55
Media Library /wp-admin/upload.php3.30 ▲0.0838.25 ▲3.70

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 62 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Dominant Color
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲8314.47 ▲0.111.94 ▲0.1541.96 ▼1.79
Dashboard /wp-admin2,210 ▲195.86 ▲0.95101.94 ▼10.8238.04 ▼11.41
Posts /wp-admin/edit.php2,093 ▲222.05 ▲0.0540.38 ▲0.4234.89 ▲2.21
Add New Post /wp-admin/post-new.php1,518 ▼1017.59 ▼0.68660.83 ▲62.9051.07 ▲0.28
Media Library /wp-admin/upload.php1,392 ▲74.18 ▼0.1093.77 ▼8.8939.94 ▼3.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
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 18× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/tests/Image/Adapter/BaseImageAdapterTest.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'ColorThief\\Image\\Adapter\\ImageAdapter' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/lib/ColorThief/Image/Adapter/ImagickImageAdapter.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/tests/VBoxTest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'ColorThief\\Image\\Adapter\\Test\\BaseImageAdapterTest' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/tests/Image/Adapter/ImagickImageAdapterTest.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'ColorThief\\Image\\Adapter\\ImageAdapter' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/lib/ColorThief/Image/Adapter/GDImageAdapter.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'ColorThief\\Image\\Adapter\\AbstractAdapter' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/src/ColorThief/Image/Adapter/ImagickAdapter.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'ColorThief\\Image\\Adapter\\AbstractAdapter' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/src/ColorThief/Image/Adapter/GmagickAdapter.php:23
    • > PHP Fatal error
      Uncaught Error: Interface 'ColorThief\\Exception\\Exception' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/src/ColorThief/Exception/RuntimeException.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/dominant-color/dominant-color.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'ColorThief\\Image\\Adapter\\AdapterInterface' not found in wp-content/plugins/dominant-color/vendor/ksubileau/color-thief-php/src/ColorThief/Image/Adapter/AbstractAdapter.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration Passed 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: colour, dominance, automatic, image, color...

dominant-color/dominant-color.php Passed 13 tests

"Dominant Color" version 2.2.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
88 characters long description:
Add an attachment meta option to provide the hex of the most dominant color of an image.

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
Success! There were no dangerous files found in this plugin3,244 lines of code in 51 files:
LanguageFilesBlank linesComment linesLines of code
PHP417131,2922,930
JSON360124
Markdown3440106
YAML16134
XML10022
JavaScript10116
CSS12012

PHP code Passed 2 tests

Analyzing 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.34
Average class complexity11.35
▷ Minimum class complexity1.00
▷ Maximum class complexity65.00
Average method complexity2.50
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces9
Interfaces3
Traits0
Classes31
▷ Abstract classes39.68%
▷ Concrete classes2890.32%
▷ Final classes00.00%
Methods249
▷ Static methods4618.47%
▷ Public methods21485.94%
▷ Protected methods166.43%
▷ Private methods197.63%
Functions19
▷ Named functions947.37%
▷ Anonymous functions1052.63%
Constants10
▷ Global constants00.00%
▷ Class constants10100.00%
▷ Public constants10100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 2.09MB with 1.60MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/ksubileau/color-thief-php/tests/images/pixels.png1.13KB0.21KB▼ 81.56%
vendor/ksubileau/color-thief-php/tests/images/vegetables_1500x995.png2,141.77KB620.50KB▼ 71.03%