84% wp-cloudflare-guard

Code Review | WP Cloudflare Guard

WordPress plugin WP Cloudflare Guard scored84%from 54 tests.

About plugin

  • Plugin page: wp-cloudflare-guard
  • Plugin version: 0.2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-4.7.3
  • WordPress version: 6.3.1
  • First release: Jan 3, 2017
  • Latest release: Apr 22, 2017
  • Number of updates: 16
  • Update frequency: every 6.4 days
  • Top authors: tangrufus (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

40+ active /2,129 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.65MB] [CPU: ▼1.81ms] Passed 4 tests

An overview of server-side resources used by WP Cloudflare Guard
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4547.13 ▲5.12
Dashboard /wp-admin4.04 ▲0.6956.24 ▼8.38
Posts /wp-admin/edit.php4.15 ▲0.7956.81 ▲8.96
Add New Post /wp-admin/post-new.php6.64 ▲0.7594.55 ▼5.97
Media Library /wp-admin/upload.php3.96 ▲0.7346.41 ▲2.00
WP Cloudflare Guard /wp-admin/admin.php?page=wpcfg-cloudflare4.0438.46
Bad Login /wp-admin/admin.php?page=wpcfg-bad-login4.0239.97

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 136 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
db_upgraded
widget_recent-comments
can_compress_scripts
wrm_a87d157b6f87b8521211

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP Cloudflare Guard
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,821 ▲7514.39 ▲0.121.74 ▲0.0843.54 ▲1.69
Dashboard /wp-admin2,224 ▲445.68 ▲0.0287.19 ▼4.3841.49 ▲2.75
Posts /wp-admin/edit.php2,132 ▲322.02 ▲0.0235.14 ▲0.2133.77 ▼5.20
Add New Post /wp-admin/post-new.php1,553 ▲2723.18 ▲2.20694.78 ▲12.7158.94 ▲2.03
Media Library /wp-admin/upload.php1,429 ▲324.26 ▲0.03102.23 ▼22.8545.68 ▼5.47
WP Cloudflare Guard /wp-admin/admin.php?page=wpcfg-cloudflare8592.0523.7427.52
Bad Login /wp-admin/admin.php?page=wpcfg-bad-login8372.1525.0429.13

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
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • wrm_a87d157b6f87b8521211
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means 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
Please fix the following items
  • 68× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function TypistTech\\WPCFG\\Vendor\\TypistTech\\WPBetterSettings\\esc_html() in wp-content/plugins/wp-cloudflare-guard/vendor/typisttech/wp-better-settings/src/partials/fields/checkbox.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'TypistTech\\WPCFG\\Vendor\\League\\Container\\Container' not found in wp-content/plugins/wp-cloudflare-guard/src/Container.php:36
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\WPCFG\\LoadableInterface' not found in wp-content/plugins/wp-cloudflare-guard/src/Cloudflare/Admin.php:35
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\WPCFG\\Vendor\\League\\Container\\Argument\\ArgumentResolverInterface' not found in wp-content/plugins/wp-cloudflare-guard/vendor/league/container/src/ReflectionContainer.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\WPCFG\\Vendor\\League\\Container\\ImmutableContainerAwareInterface' not found in wp-content/plugins/wp-cloudflare-guard/vendor/league/container/src/Definition/DefinitionFactoryInterface.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\WPCFG\\Vendor\\League\\Container\\ContainerInterface' not found in wp-content/plugins/wp-cloudflare-guard/vendor/league/container/src/Container.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\WPCFG\\LoadableInterface' not found in wp-content/plugins/wp-cloudflare-guard/src/Ads/I18nPromoter.php:31
    • > PHP Fatal error
      Uncaught Error: Class 'TypistTech\\WPCFG\\Vendor\\TypistTech\\WPContainedHook\\AbstractHook' not found in wp-content/plugins/wp-cloudflare-guard/vendor/typisttech/wp-contained-hook/src/Action.php:22
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\WPCFG\\Vendor\\League\\Container\\ImmutableContainerAwareInterface' not found in wp-content/plugins/wp-cloudflare-guard/vendor/league/container/src/Argument/ArgumentResolverInterface.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\WPCFG\\Vendor\\Interop\\Container\\Exception\\ContainerException' not found in wp-content/plugins/wp-cloudflare-guard/vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed: You can look at the official readme.txt

wp-cloudflare-guard/wp-cloudflare-guard.php Passed 13 tests

The main PHP script in "WP Cloudflare Guard" version 0.2.0 is automatically included on every request by WordPress
46 characters long description:
Connecting WordPress with Cloudflare firewall.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin5,143 lines of code in 125 files:
LanguageFilesBlank linesComment linesLines of code
PHP1131,2373,9404,116
JSON900961
Bourne Again Shell18033
Markdown12019
JavaScript12314

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity3.87
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity1.88
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces28
Interfaces28
Traits6
Classes65
▷ Abstract classes69.23%
▷ Concrete classes5990.77%
▷ Final classes3559.32%
Methods365
▷ Static methods205.48%
▷ Public methods28979.18%
▷ Protected methods287.67%
▷ Private methods4813.15%
Functions20
▷ Named functions630.00%
▷ Anonymous functions1470.00%
Constants4
▷ Global constants00.00%
▷ Class constants4100.00%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin