83% cookie-consent-for-developers

Code Review | Cookie consent for developers

WordPress plugin Cookie consent for developers scored83%from 54 tests.

About plugin

  • Plugin page: cookie-consent-fo...
  • Plugin version: 1.7.1
  • PHP compatiblity: 5.6.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.6-6.2.0
  • WordPress version: 6.3.1
  • First release: Oct 31, 2018
  • Latest release: May 3, 2023
  • Number of updates: 67
  • Update frequency: every 24.6 days
  • Top authors: lovor (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /1,910 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 gracefully, with no errors

Server metrics [RAM: ▲0.04MB] [CPU: ▼4.21ms] Passed 4 tests

Server-side resources used by Cookie consent for developers
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0847.68 ▲7.39
Dashboard /wp-admin3.35 ▲0.0450.27 ▼3.32
Posts /wp-admin/edit.php3.40 ▲0.0452.14 ▼3.27
Add New Post /wp-admin/post-new.php5.93 ▲0.0492.07 ▼9.46
Media Library /wp-admin/upload.php3.27 ▲0.0438.03 ▼0.80
Cookie consent for developers /wp-admin/options-general.php?page=ntgccPage3.2436.96

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 26 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Cookie consent for developers
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,817 ▲5614.35 ▼0.042.61 ▲0.9144.99 ▲1.96
Dashboard /wp-admin2,201 ▲245.65 ▲0.0881.88 ▼16.4837.18 ▼4.41
Posts /wp-admin/edit.php2,103 ▲32.02 ▲0.0735.71 ▼3.5931.45 ▼4.15
Add New Post /wp-admin/post-new.php1,531 ▲523.00 ▼0.08662.49 ▼22.3457.54 ▼5.37
Media Library /wp-admin/upload.php1,400 ▼34.24 ▲0.03107.07 ▲1.2643.97 ▼4.79
Cookie consent for developers /wp-admin/options-general.php?page=ntgccPage1,0382.0023.2536.58

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
Almost there! Just fix the following items
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/cookie-consent-for-developers/uninstall.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/cookie-consent-for-developers/public/partials/ntg-cookie-consent-public-display.php:31

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
You can look at the official readme.txt

cookie-consent-for-developers/ntg-cookie-consent.php 85% from 13 tests

The principal PHP file in "Cookie consent for developers" v. 1.7.1 is loaded by WordPress automatically on each request
It is important to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("cookie-consent-for-developers.php" instead of "ntg-cookie-consent.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 detected774 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
PHP12182612557
CSS42115131
PO File1232683
JavaScript12273

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity2.86
▷ Minimum class complexity1.00
▷ Maximum class complexity7.00
Average method complexity1.43
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods30
▷ Static methods26.67%
▷ Public methods2583.33%
▷ Protected methods00.00%
▷ Private methods516.67%
Functions20
▷ Named functions20100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/images/03GO_logo.png10.81KB5.09KB▼ 52.91%