78% custom-cookie-message

Code Review | Custom Cookie Message

WordPress plugin Custom Cookie Message scored78%from 54 tests.

About plugin

  • Plugin page: custom-cookie-mes...
  • Plugin version: 2.4.10
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.5
  • WordPress version: 6.3.1
  • First release: Oct 31, 2016
  • Latest release: Sep 1, 2020
  • Number of updates: 109
  • Update frequency: every 12.9 days
  • Top authors: victorcamnerin (21.1%)hosam87 (20.18%)eliaschalhoub (16.51%)killua99 (15.6%)kylegard (15.6%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /9,124 total downloads

Benchmarks

Plugin footprint 83% from 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.49MB] [CPU: ▼24.70ms] Passed 4 tests

This is a short check of server-side resources used by Custom Cookie Message
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1635.51 ▼7.48
Dashboard /wp-admin3.50 ▲0.2045.80 ▼1.32
Posts /wp-admin/edit.php3.62 ▲0.2643.41 ▼8.07
Add New Post /wp-admin/post-new.php3.38 ▼2.5037.18 ▼81.92
Media Library /wp-admin/upload.php3.43 ▲0.2037.53 ▲1.50
Custom Cookie Message /wp-admin/options-general.php?page=custom_cookie_message_options3.6534.24

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 52 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
widget_recent-posts
custom_cookie_message

Browser metrics Passed 4 tests

Checking browser requirements for Custom Cookie Message
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,226 ▲49113.75 ▼0.2814.60 ▲12.8843.80 ▼6.20
Dashboard /wp-admin2,210 ▲225.85 ▲0.9699.63 ▼3.0440.00 ▼2.56
Posts /wp-admin/edit.php2,093 ▲72.02 ▲0.0434.47 ▼1.7732.82 ▼1.22
Add New Post /wp-admin/post-new.php1,536 ▲823.16 ▲4.65599.73 ▼25.6348.35 ▼16.80
Media Library /wp-admin/upload.php1,392 ▲14.15 ▼0.1793.27 ▼8.5140.56 ▼1.93
Custom Cookie Message /wp-admin/options-general.php?page=custom_cookie_message_options1,0852.4967.0129.68

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_theysaidso_widget
    • custom_cookie_message
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 50% 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 0% 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
Please take a closer look at the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/custom-cookie-message/tests/bootstrap.php
  • 10× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/custom-cookie-message/templates/cookie-notice.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'CustomCookieMessage\\Forms\\AdminBase' not found in wp-content/plugins/custom-cookie-message/src/Forms/class-admincookiesettings.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'CustomCookieMessage\\Forms\\AdminBase' not found in wp-content/plugins/custom-cookie-message/src/Forms/class-admincontentoptions.php:15
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-cookie-message/templates/cookie-notice.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/custom-cookie-message/tests/test-custom-cookie-message.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'CustomCookieMessage\\Forms\\AdminBase' not found in wp-content/plugins/custom-cookie-message/src/Forms/class-adminstylingoptions.php:15
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/plugin.php' (include_path='.:/usr/share/php') in wp-content/plugins/custom-cookie-message/templates/cookie-notice.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'CustomCookieMessage\\Forms\\AdminBase' not found in wp-content/plugins/custom-cookie-message/src/Forms/class-admingeneraloptions.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'CustomCookieMessage\\Forms\\AdminBase' not found in wp-content/plugins/custom-cookie-message/src/Forms/class-adminexportsettings.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'CustomCookieMessage\\Forms\\AdminBase' not found in wp-content/plugins/custom-cookie-message/src/Forms/class-adminform.php:17

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that need to be fixed:
  • Tags: Too many tags (24 tag instead of maximum 10); only the first 5 tags are used in your directory listing
  • Requires php: Invalid plugin version format
You can look at the official readme.txt

custom-cookie-message/custom-cookie-message.php Passed 13 tests

Analyzing the main PHP file in "Custom Cookie Message" version 2.4.10
63 characters long description:
A customizable cookie message, compatible with GDPR compliance.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected10,811 lines of code in 43 files:
LanguageFilesBlank linesComment linesLines of code
JSON3007,485
PHP194638421,570
JavaScript814032654
Sass3530348
CSS3556289
PO File1110122283
Bourne Shell22614130
XML33944
Markdown1408

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity8.53
▷ Minimum class complexity1.00
▷ Maximum class complexity36.00
Average method complexity1.88
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces3
Interfaces0
Traits1
Classes14
▷ Abstract classes00.00%
▷ Concrete classes14100.00%
▷ Final classes00.00%
Methods123
▷ Static methods2016.26%
▷ Public methods11996.75%
▷ Protected methods43.25%
▷ Private methods00.00%
Functions4
▷ Named functions00.00%
▷ Anonymous functions4100.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 PNG files occupy 0.02MB with 0.02MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
build-icons/warning.png2.41KB0.44KB▼ 81.81%
build-icons/failure.png2.36KB0.44KB▼ 81.37%
build-icons/success.png2.23KB0.28KB▼ 87.34%
build-icons/logo.png18.39KB12.12KB▼ 34.11%