83% eu-cookie-law-compliance

Code Review | EU Cookie Law Compliance

WordPress plugin EU Cookie Law Compliance scored83%from 54 tests.

About plugin

  • Plugin page: eu-cookie-law-com...
  • Plugin version: 1.0.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-5.1
  • WordPress version: 6.3.1
  • First release: Jun 27, 2016
  • Latest release: Apr 27, 2019
  • Number of updates: 4
  • Update frequency: every 258.8 days
  • Top authors: damian-gora (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

3,000+ active /21,492 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.35MB] [CPU: ▼2.73ms] Passed 4 tests

Analyzing server-side resources used by EU Cookie Law Compliance
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.81 ▲0.3546.73 ▲6.57
Dashboard /wp-admin3.71 ▲0.4150.08 ▲1.10
Posts /wp-admin/edit.php3.76 ▲0.4155.78 ▲10.07
Add New Post /wp-admin/post-new.php6.20 ▲0.3283.27 ▼18.13
Media Library /wp-admin/upload.php3.55 ▲0.3235.86 ▼0.44
TP Cookies Law /wp-admin/options-general.php?page=tplis_cl_settings3.5838.80

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 29 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
db_upgraded
tplis_cl_settings
can_compress_scripts
tplis_cl_version

Browser metrics Passed 4 tests

A check of browser resources used by EU Cookie Law Compliance
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,002 ▲25615.00 ▲0.743.07 ▲1.4442.30 ▲2.03
Dashboard /wp-admin2,372 ▲1876.66 ▲0.80134.56 ▲33.2340.32 ▼5.27
Posts /wp-admin/edit.php2,283 ▲1943.50 ▲1.5050.97 ▲14.6030.30 ▼6.03
Add New Post /wp-admin/post-new.php1,534 ▲1517.71 ▼5.48630.61 ▼39.1736.54 ▼32.59
Media Library /wp-admin/upload.php1,417 ▲324.27 ▲0.0581.70 ▼21.9441.61 ▼3.38
TP Cookies Law /wp-admin/options-general.php?page=tplis_cl_settings2,6158.02195.0659.84

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_recent-comments
    • tplis_cl_settings
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • tplis_cl_version
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 5× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/eu-cookie-law-compliance/includes/templates/layout-4/layout-html.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/eu-cookie-law-compliance/includes/admin/settings/class-settings.php:375
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/eu-cookie-law-compliance/includes/templates/layout-2/layout-html.php:3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/eu-cookie-law-compliance/includes/templates/layout-1/layout-html.php:2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/eu-cookie-law-compliance/includes/templates/layout-3/layout-html.php:1

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 errors were detected

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 14 tag instead of maximum 10
You can look at the official readme.txt

eu-cookie-law-compliance/tplis-cookies.php 77% from 13 tests

The main PHP file in "EU Cookie Law Compliance" ver. 1.0.3 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Description: The description should be shorter than 140 characters (currently 150 characters long)
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("eu-cookie-law-compliance.php" instead of "tplis-cookies.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
Good job! No executable or dangerous file extensions detected2,482 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
PHP165306091,767
CSS51015467
JavaScript13136208
SVG10130
XML10010

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity19.50
▷ Minimum class complexity1.00
▷ Maximum class complexity58.00
Average method complexity3.11
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes112.50%
Methods70
▷ Static methods1115.71%
▷ Public methods5578.57%
▷ Protected methods00.00%
▷ Private methods1521.43%
Functions16
▷ Named functions1593.75%
▷ Anonymous functions16.25%
Constants14
▷ Global constants14100.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
No PNG images were found in this plugin