84% civic-cookie-control-8

Code Review | Civic Cookie Control

WordPress plugin Civic Cookie Control scored84%from 54 tests.

About plugin

  • Plugin page: civic-cookie-cont...
  • Plugin version: 1.50
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.3.2
  • WordPress version: 6.3.1
  • First release: Feb 8, 2019
  • Latest release: Nov 1, 2023
  • Number of updates: 55
  • Update frequency: every 31.4 days
  • Top authors: tasoscivicuk (89.09%)aperperis (12.73%)

Code review

54 tests

User reviews

7 reviews

Install metrics

3,000+ active /52,765 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.10MB] [CPU: ▼7.71ms] Passed 4 tests

Server-side resources used by Civic Cookie Control
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.29 ▲0.8240.09 ▼0.41
Dashboard /wp-admin3.40 ▲0.0547.18 ▼14.03
Posts /wp-admin/edit.php3.52 ▲0.1548.39 ▲1.77
Add New Post /wp-admin/post-new.php6.00 ▲0.1186.81 ▼16.25
Media Library /wp-admin/upload.php3.32 ▲0.0936.67 ▼0.14

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Civic Cookie Control
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,901 ▲15513.47 ▼0.807.23 ▲5.4541.67 ▼4.02
Dashboard /wp-admin2,247 ▲665.91 ▲0.2788.28 ▼13.3939.22 ▼3.42
Posts /wp-admin/edit.php2,154 ▲542.39 ▲0.4541.48 ▲6.5630.15 ▼5.69
Add New Post /wp-admin/post-new.php1,568 ▲4023.32 ▲0.16662.35 ▲19.8434.91 ▼10.48
Media Library /wp-admin/upload.php1,449 ▲524.68 ▲0.48101.77 ▲6.2339.22 ▼4.21

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 6× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/civic-cookie-control-8/admin/partials/v8/admin-form-fields-display.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/civic-cookie-control-8/admin/partials/v9/admin-form-fields-display.php:3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/civic-cookie-control-8/admin/partials/cookie-control-admin-display.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/civic-cookie-control-8/public/templates/govuk-cookiecontrol-details.php:2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/civic-cookie-control-8/public/templates/govuk-cookiecontrol-public-inputs.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/civic-cookie-control-8/public/templates/govuk-cookiecontrol-banner.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: cookie legislation, gdpr, cookie, eu cookie law, cookies

civic-cookie-control-8/cookiecontrol-settings.php 92% from 13 tests

This is the main PHP file of "Civic Cookie Control" version 1.50, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("civic-cookie-control-8.php" instead of "cookiecontrol-settings.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected15,274 lines of code in 35 files:
LanguageFilesBlank linesComment linesLines of code
Sass11,23106,855
PHP215725695,784
CSS390521,584
JavaScript783101,006
JSON10037
XML1005
JSX1173

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
It is recommended to fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 235)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity68.22
▷ Minimum class complexity1.00
▷ Maximum class complexity375.00
Average method complexity11.61
▷ Minimum method complexity1.00
▷ Maximum method complexity235.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods57
▷ Static methods23.51%
▷ Public methods5291.23%
▷ Protected methods00.00%
▷ Private methods58.77%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
4 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/CookieControl_Civic.png10.03KB3.34KB▼ 66.73%
admin/images/ccc-logo.png0.96KB0.53KB▼ 45.00%
admin/images/icon-triangle.png1.03KB0.55KB▼ 45.96%
admin/images/icon-diamond.png1.63KB1.15KB▼ 29.60%