83% cookie-notice-and-consent-banner

Code Review | Cookie Notice & Consent Banner for GDPR & CCPA Compliance

WordPress plugin Cookie Notice & Consent Banner for GDPR & CCPA Compliance scored83%from 54 tests.

About plugin

  • Plugin page: cookie-notice-and...
  • Plugin version: 1.7.6
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Apr 15, 2020
  • Latest release: Aug 28, 2023
  • Number of updates: 48
  • Update frequency: every 25.6 days
  • Top authors: artemari (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

2,000+ active /28,992 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.33MB] [CPU: ▼6.98ms] Passed 4 tests

A check of server-side resources used by Cookie Notice & Consent Banner for GDPR & CCPA Compliance
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.74 ▲0.2840.41 ▼5.82
Dashboard /wp-admin3.66 ▲0.3254.97 ▼12.53
Posts /wp-admin/edit.php3.77 ▲0.4256.66 ▲10.44
Add New Post /wp-admin/post-new.php6.26 ▲0.3798.74 ▼13.02
Media Library /wp-admin/upload.php3.58 ▲0.3537.66 ▲3.47
Settings /wp-admin/admin.php?page=cncb_options3.5533.88

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 69 new files
Database: no new tables, 15 new options
New WordPress options
cncb_by_scroll_value
cncb_by_click
cncb_by_delay_value
widget_recent-posts
widget_theysaidso_widget
cncb_refuse_code_body
cncb_refuse_code
cncb_show_banner
db_upgraded
theysaidso_admin_options
...

Browser metrics Passed 4 tests

Checking browser requirements for Cookie Notice & Consent Banner for GDPR & CCPA Compliance
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,859 ▲9814.39 ▲0.046.35 ▲4.5050.59 ▲2.13
Dashboard /wp-admin2,240 ▲635.51 ▼0.0985.79 ▼14.2545.71 ▲1.51
Posts /wp-admin/edit.php2,149 ▲492.07 ▲0.1042.30 ▲7.2438.98 ▲6.04
Add New Post /wp-admin/post-new.php1,549 ▲2123.47 ▲0.40681.26 ▲20.2777.90 ▲28.32
Media Library /wp-admin/upload.php1,427 ▲274.24 ▲0.06104.30 ▲2.5745.82 ▲1.77
Settings /wp-admin/admin.php?page=cncb_options1,0812.0423.6829.08

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options were found after uninstall: 8 options
    • db_upgraded
    • cncb_refuse_code
    • cncb_refuse_code_body
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget

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 | 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
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Section' not found in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/sections/class-cncb-section.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'CNCB_Custom_Control' not found in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/controls/class-cncb-image-radio-button-custom-control.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Control' not found in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/controls/class-cncb-custom-control.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cookie-notice-and-consent-banner/includes/admin/class-cncb-admin.php:63
    • > PHP Fatal error
      Uncaught Error: Class 'CNCB_Custom_Control' not found in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/controls/class-cncb-link-custom-control.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cookie-notice-and-consent-banner/includes/admin/class-cncb-deactivate-popup.php:48
    • > PHP Fatal error
      Uncaught Error: Class 'CNCB_Custom_Control' not found in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/controls/class-cncb-palette-radio-button-custom-control.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'CNCB_Custom_Control' not found in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/controls/class-cncb-text-custom-control.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'CNCB_Custom_Control' not found in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/controls/class-cncb-space-custom-control.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cookie-notice-and-consent-banner/includes/customizer/custom-controls.php:10

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)
No browser issues were found

Optimizations

Plugin configuration 90% 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 need to be fixed:
  • Screenshots: These screenshots lack descriptions #1, #2 in cookie-notice-and-consent-banner/assets to your readme.txt
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

cookie-notice-and-consent-banner/class-cncb-main.php 92% from 13 tests

"Cookie Notice & Consent Banner for GDPR & CCPA Compliance" version 1.7.6's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("cookie-notice-and-consent-banner.php" instead of "class-cncb-main.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected5,141 lines of code in 39 files:
LanguageFilesBlank linesComment linesLines of code
PHP162546482,435
JavaScript1298181,204
PO File3364476831
CSS84223671

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity10.69
▷ Minimum class complexity1.00
▷ Maximum class complexity58.00
Average method complexity3.36
▷ Minimum method complexity1.00
▷ Maximum method complexity54.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes13
▷ Abstract classes00.00%
▷ Concrete classes13100.00%
▷ Final classes17.69%
Methods54
▷ Static methods916.67%
▷ Public methods3870.37%
▷ Protected methods11.85%
▷ Private methods1527.78%
Functions9
▷ Named functions888.89%
▷ Anonymous functions111.11%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
18 PNG files occupy 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/position-top-right.png0.30KB0.13KB▼ 58.12%
img/position-bottom-left.png0.30KB0.13KB▼ 57.33%
img/btn-type-2.png6.08KB2.91KB▼ 52.07%
img/form-line.png0.30KB0.13KB▼ 58.20%
img/blank-rectangle.png5.20KB1.68KB▼ 67.67%