78% cookies-and-content-security-policy

Code Review | Cookies and Content Security Policy

WordPress plugin Cookies and Content Security Policy scored 78% from 54 tests.

About plugin

  • Plugin page: cookies-and-conte...
  • Plugin version: 2.17
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.2
  • WordPress version: 6.3.1
  • First release: Mar 7, 2020
  • Latest release: Aug 4, 2023
  • Number of updates: 230
  • Update frequency: every 5.4 days
  • Top authors: jonkastonka (100%)

Code review

54 tests

User reviews

53 reviews

Install metrics

10,000+ active / 244,732 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.18MB] [CPU: ▼0.25ms] Passed 4 tests

Analyzing server-side resources used by Cookies and Content Security Policy
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1940.84 ▼2.91
Dashboard /wp-admin3.48 ▲0.1747.99 ▼4.24
Posts /wp-admin/edit.php3.59 ▲0.2349.78 ▲4.70
Add New Post /wp-admin/post-new.php6.06 ▲0.1795.20 ▲5.07
Media Library /wp-admin/upload.php3.40 ▲0.1736.36 ▲1.46
Cookies and Content Security Policy /wp-admin/options-general.php?page=cacsp_settings3.7133.57

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Cookies and Content Security Policy
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,848 ▲9113.35 ▼1.031.89 ▼0.1440.92 ▼4.57
Dashboard /wp-admin2,232 ▲415.03 ▼0.87111.01 ▲5.7141.00 ▲1.40
Posts /wp-admin/edit.php2,117 ▲282.32 ▲0.1442.13 ▲4.4335.05 ▲6.39
Add New Post /wp-admin/post-new.php1,531 ▼217.79 ▼5.21663.93 ▼12.2436.62 ▼28.10
Media Library /wp-admin/upload.php1,414 ▲294.36 ▲0.1596.96 ▼3.6842.11 ▼5.48
Cookies and Content Security Policy /wp-admin/options-general.php?page=cacsp_settings8932.1227.6929.34

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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 fix the following items
  • 14× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/functions.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/settings-cacsp-tab-colors.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/settings-cacsp-tab-texts.php
    • > /wp-content/plugins/cookies-and-content-security-policy/cookies-and-content-security-policy.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/modal-cacsp.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/settings-cacsp-tab-quickstart.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/settings-cacsp-tab-settings.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/set-cacsp.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/settings-cacsp-tab-support.php
    • > /wp-content/plugins/cookies-and-content-security-policy/inc/settings-cacsp-tab-domains.php
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/cookies-and-content-security-policy/inc/plugin-compability.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cookies-and-content-security-policy/inc/network.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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
These attributes need to be fixed:
  • Tags: There are too many tags (12 tag instead of maximum 10)
Please take inspiration from this readme.txt

cookies-and-content-security-policy/cookies-and-content-security-policy.php 92% from 13 tests

The principal PHP file in "Cookies and Content Security Policy" v. 2.17 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Description: The description should be shorter than 140 characters (currently 178 characters long)

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 detected4,568 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP1897592,987
PO File1223258641
Sass4713617
JavaScript31925294
XML10027
CSS2022

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions32
▷ Named functions2990.62%
▷ Anonymous functions39.38%
Constants1
▷ Global constants1100.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
2 PNG files occupy 0.26MB with 0.17MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/grandma.png177.60KB52.97KB▼ 70.17%
img/cookie.png90.16KB34.35KB▼ 61.91%