94% acf-color-swatches

Code Review | ACF Color Swatches

WordPress plugin ACF Color Swatches scored 94% from 54 tests.

About plugin

  • Plugin page: acf-color-swatches
  • Plugin version: 1.0.7
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0+
  • WordPress version: 5.9.2
  • First release: Feb 14, 2018
  • Latest release: Nov 29, 2018
  • Number of updates: 5
  • Update frequency: every 156.4 days
  • Top authors: nickforddesign (80%)deployer (40%)

Code review

54 tests

User reviews

1 review

Install metrics

1,000+ active / 11,569 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.02MB] [CPU: ▼299.28ms] Passed 4 tests

An overview of server-side resources used by ACF Color Swatches
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0152.67 ▲4.15
Dashboard /wp-admin3.41 ▲0.0133.10 ▲0.60
Posts /wp-admin/edit.php3.65 ▲0.0137.52 ▲2.25
Add New Post /wp-admin/post-new.php6.89 ▼0.0898.23 ▼1,194.99
Media Library /wp-admin/upload.php3.30 ▼0.0022.80 ▼4.97

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 15 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

ACF Color Swatches: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,796 ▲5216.01 ▲0.235.89 ▼0.642.62 ▲0.59
Dashboard /wp-admin2,895 ▲346.01 ▼0.16117.79 ▼17.32157.47 ▼4.22
Posts /wp-admin/edit.php2,694 ▼03.24 ▲0.0163.57 ▲0.17140.89 ▼3.13
Add New Post /wp-admin/post-new.php1,763 ▲10219.04 ▲2.92378.81 ▼35.75157.15 ▲0.99
Media Library /wp-admin/upload.php1,701 ▼05.50 ▼0.02147.71 ▼0.01183.83 ▼2.71

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The plugin uninstalled completely, with no zombie files or tables

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)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/acf-color-swatches/acf-swatch.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/acf-color-swatches/acf-swatch-v4.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 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
Please fix the following attributes:
  • Tested up to: Invalid plugin version format
Please take inspiration from this readme.txt

acf-color-swatches/acf-swatch.php 92% from 13 tests

This is the main PHP file of "ACF Color Swatches" version 1.0.7, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("acf-color-swatches.php" instead of "acf-swatch.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected658 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP395259381
Markdown4620143
JavaScript128361
CSS110059
JSON10014

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity20.00
▷ Minimum class complexity16.00
▷ Maximum class complexity24.00
Average method complexity3.92
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods13
▷ Static methods00.00%
▷ Public methods13100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
3 PNG files occupy 0.06MB with 0.04MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/choices.png39.20KB11.60KB▼ 70.41%
images/checkers.png0.22KB0.10KB▼ 56.58%
images/swatches.png24.82KB6.99KB▼ 71.85%