84% content-security-policy-pro

Code Review | Content Security Policy Pro

WordPress plugin Content Security Policy Pro scored84%from 54 tests.

About plugin

  • Plugin page: content-security-...
  • Plugin version: 1.3.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.1.1
  • WordPress version: 6.3.1
  • First release: Sep 21, 2016
  • Latest release: Apr 4, 2019
  • Number of updates: 27
  • Update frequency: every 34.3 days
  • Top authors: thapa.laxman (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

500+ active /9,581 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
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼5.33ms] Passed 4 tests

A check of server-side resources used by Content Security Policy Pro
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0646.13 ▼2.56
Dashboard /wp-admin3.37 ▲0.0650.57 ▼6.88
Posts /wp-admin/edit.php3.48 ▲0.1253.93 ▲1.22
Add New Post /wp-admin/post-new.php5.95 ▲0.0688.03 ▼11.15
Media Library /wp-admin/upload.php3.29 ▲0.0636.97 ▼0.71

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 28 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Content Security Policy Pro
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲4414.72 ▲0.542.28 ▲0.5544.67 ▼0.10
Dashboard /wp-admin2,211 ▲345.52 ▼0.0589.76 ▼0.0438.58 ▼0.49
Posts /wp-admin/edit.php2,116 ▲162.01 ▼0.0143.62 ▲2.6839.20 ▲0.90
Add New Post /wp-admin/post-new.php1,539 ▲1323.52 ▲0.22607.44 ▼42.3151.79 ▼0.67
Media Library /wp-admin/upload.php1,416 ▲194.23 ▲0.0699.62 ▼13.3441.63 ▼3.61

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded

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
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/content-security-policy-pro/public/partials/content-security-policy-public-display.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
3 plugin tags: cps, security, content security policy

content-security-policy-pro/content-security-policy-pro.php 85% from 13 tests

The main PHP file in "Content Security Policy Pro" ver. 1.3.5 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Description: Keep the plugin description shorter than 140 characters (currently 238 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin3,495 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript61421692,981
PHP12150489497
JSON10016
CSS2081

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity4.40
▷ Minimum class complexity1.00
▷ Maximum class complexity9.00
Average method complexity1.68
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods25
▷ Static methods14.00%
▷ Public methods1976.00%
▷ Protected methods28.00%
▷ Private methods416.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
No PNG files were detected