84% cloudflare

Code Review | Cloudflare

WordPress plugin Cloudflare scored84%from 54 tests.

About plugin

  • Plugin page: cloudflare
  • Plugin version: 4.12.2
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-6.2
  • WordPress version: 6.3.1
  • First release: Oct 19, 2010
  • Latest release: Jul 18, 2023
  • Number of updates: 163
  • Update frequency: every 28.6 days
  • Top authors: manatarms (21.47%)i3149 (17.79%)jchen329 (14.11%)jamescf (14.11%)furkan811 (13.5%)

Code review

54 tests

User reviews

169 reviews

Install metrics

200,000+ active /6,948,502 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.46MB] [CPU: ▼6.93ms] Passed 4 tests

An overview of server-side resources used by Cloudflare
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4542.96 ▲4.30
Dashboard /wp-admin3.76 ▲0.4648.99 ▼3.91
Posts /wp-admin/edit.php3.88 ▲0.5245.51 ▼10.07
Add New Post /wp-admin/post-new.php6.34 ▲0.4584.62 ▼16.27
Media Library /wp-admin/upload.php3.69 ▲0.4538.82 ▲2.53
Cloudflare /wp-admin/options-general.php?page=cloudflare3.6635.94

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 222 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Cloudflare: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6913.23 ▼1.181.75 ▲0.0843.85 ▲2.14
Dashboard /wp-admin2,210 ▲215.86 ▲0.94100.01 ▼21.3039.30 ▼7.91
Posts /wp-admin/edit.php2,093 ▲42.00 ▼0.0532.88 ▼9.7632.27 ▼2.33
Add New Post /wp-admin/post-new.php1,536 ▼023.36 ▲0.11674.48 ▼7.5655.98 ▼3.82
Media Library /wp-admin/upload.php1,386 ▲44.26 ▲0.0597.26 ▼1.6440.88 ▼2.73
Cloudflare /wp-admin/options-general.php?page=cloudflare1,1286.09157.1036.69

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
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means 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 take a closer look at the following
  • 43× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/cloudflare/src/Test/API/DefaultHttpClientTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Psr\\Log\\AbstractLogger' not found in wp-content/plugins/cloudflare/src/Integration/DefaultLogger.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'CF\\API\\Client' not found in wp-content/plugins/cloudflare/src/API/Plugin.php:7
    • > PHP Warning
      require(wp-content/plugins/cloudflare/vendor/cloudflare/cf-ip-rewrite/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/cloudflare/vendor/cloudflare/cf-ip-rewrite/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/cloudflare/src/Test/API/ClientTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/cloudflare/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'CF\\API\\AbstractPluginActions' not found in wp-content/plugins/cloudflare/src/WordPress/PluginActions.php:13
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/cloudflare/vendor/cloudflare/cf-ip-rewrite/tests/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/cloudflare/vendor/cloudflare/cf-ip-rewrite/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'CF\\API\\AbstractAPIClient' not found in wp-content/plugins/cloudflare/src/API/Client.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/cloudflare/src/Test/Router/RequestRouterTest.php:15

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 issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed: You can take inspiration from this readme.txt

cloudflare/cloudflare.php Passed 13 tests

This is the main PHP file of "Cloudflare" version 4.12.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
54 characters long description:
Cloudflare speeds up and protects your WordPress site.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Everything looks great! No dangerous files found in this plugin25,896 lines of code in 156 files:
LanguageFilesBlank linesComment linesLines of code
PHP1081,5591,90623,108
JavaScript9045843
SVG20114685
JSON800606
CSS33344456
Markdown7960185
XML12013

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
These items need your attention
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity10.13
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity2.84
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces22
Interfaces9
Traits2
Classes72
▷ Abstract classes56.94%
▷ Concrete classes6793.06%
▷ Final classes45.97%
Methods458
▷ Static methods5512.01%
▷ Public methods42793.23%
▷ Protected methods40.87%
▷ Private methods275.90%
Functions28
▷ Named functions2071.43%
▷ Anonymous functions828.57%
Constants201
▷ Global constants8039.80%
▷ Class constants12160.20%
▷ Public constants121100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
17 PNG files occupy 0.09MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/insight.png5.21KB3.77KB▼ 27.67%
assets/modal-two-factor-auth_2x.png16.99KB10.32KB▼ 39.28%
assets/select2-cf.png0.88KB0.91KB0.00%
assets/hero-bg-clouds.png3.02KB2.96KB▼ 1.97%
assets/icons-seee324dde5.png6.93KB3.56KB▼ 48.63%