89% cookie-bar

Code Review | Cookie Bar

WordPress plugin Cookie Bar scored89%from 54 tests.

About plugin

  • Plugin page: cookie-bar
  • Plugin version: 2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-6.3.2
  • WordPress version: 6.3.1
  • First release: Jun 30, 2016
  • Latest release: Oct 24, 2023
  • Number of updates: 33
  • Update frequency: every 81.0 days
  • Top authors: nimonogi (75.76%)mohsenr1 (27.27%)

Code review

54 tests

User reviews

18 reviews

Install metrics

10,000+ active /140,291 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.05MB] [CPU: ▼1.59ms] Passed 4 tests

Server-side resources used by Cookie Bar
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0537.79 ▲0.14
Dashboard /wp-admin3.36 ▲0.0644.78 ▼3.66
Posts /wp-admin/edit.php3.41 ▲0.0548.29 ▲5.84
Add New Post /wp-admin/post-new.php5.96 ▲0.0789.52 ▲0.28
Media Library /wp-admin/upload.php3.28 ▲0.0532.24 ▼3.12
Cookie Bar /wp-admin/options-general.php?page=cookie-bar-settings3.2532.91

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 9 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Cookie Bar: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,986 ▲21513.55 ▼0.808.85 ▲6.9147.31 ▲0.96
Dashboard /wp-admin2,218 ▲415.83 ▲0.2487.18 ▼16.3238.85 ▼3.89
Posts /wp-admin/edit.php2,128 ▲312.29 ▲0.3140.80 ▲4.8035.37 ▼0.03
Add New Post /wp-admin/post-new.php1,552 ▲2324.91 ▲1.25599.57 ▼68.6150.56 ▼0.46
Media Library /wp-admin/upload.php1,423 ▲264.42 ▲0.2798.53 ▼0.1839.20 ▼7.18
Cookie Bar /wp-admin/options-general.php?page=cookie-bar-settings1,4602.7455.4130.35

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
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP Passed 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
Looking good! No server-side errors or output on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Screenshots: Add images for these screenshots: #1 (Plugin Settings screenshot-1.png), #2 (Cookie Bar screenshot-2.png)
  • Tags: There are too many tags (15 tag instead of maximum 10)
The official readme.txt is a good inspiration

cookie-bar/cookie-bar.php Passed 13 tests

The primary PHP file in "Cookie Bar" version 2.1 is used by WordPress to initiate all plugin functionality
83 characters long description:
Cookie Bar allows you to discreetly inform visitors that your website uses cookies.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected378 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP25722269
SVG10141
CSS10031
JavaScript10031
XML1006

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity1.00
▷ Minimum class complexity1.00
▷ Maximum class complexity1.00
Average method complexity1.00
▷ Minimum method complexity1.00
▷ Maximum method complexity1.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods1
▷ Static methods1100.00%
▷ Public methods1100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions8100.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
2 PNG files occupy 0.11MB with 0.04MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png40.27KB38.15KB▼ 5.27%
screenshot-1.png71.00KB28.59KB▼ 59.73%