84% block-country

Code Review | Block Country

WordPress plugin Block Country scored84%from 54 tests.

About plugin

  • Plugin page: block-country
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-3.6
  • WordPress version: 6.3.1
  • First release: Dec 10, 2013
  • Latest release: Dec 11, 2013
  • Number of updates: 3
  • Update frequency: every 0.3 days
  • Top authors: nitinmaurya12 (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

100+ active /4,980 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.01MB] [CPU: ▼8.31ms] Passed 4 tests

This is a short check of server-side resources used by Block Country
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.39 ▼0.0725.74 ▼13.97
Dashboard /wp-admin3.31 ▲0.0143.67 ▼7.91
Posts /wp-admin/edit.php3.36 ▲0.0147.25 ▲0.83
Add New Post /wp-admin/post-new.php5.89 ▲0.0182.46 ▼12.19
Media Library /wp-admin/upload.php3.23 ▲0.0138.46 ▲5.41

Server storage [IO: ▲0.07MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 5 new files
Database: 1 new table, 6 new options
New tables
wp_country
New WordPress options
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
db_upgraded
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Block Country
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲3413.28 ▼1.531.75 ▼0.7843.99 ▲1.97
Dashboard /wp-admin2,221 ▲304.92 ▲0.05106.97 ▼5.4572.70 ▲32.76
Posts /wp-admin/edit.php2,110 ▲182.12 ▲0.0839.07 ▼1.9333.94 ▼2.53
Add New Post /wp-admin/post-new.php1,417 ▼10218.19 ▼4.96723.64 ▲124.5946.13 ▼4.87
Media Library /wp-admin/upload.php1,400 ▲154.21 ▲0.01102.87 ▲0.4671.69 ▲26.72

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts

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
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
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 _e() in wp-content/plugins/block-country/form.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/block-country/block-country.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Screenshot #1 (Block Country) image missing
Please take inspiration from this readme.txt

block-country/block-country.php Passed 13 tests

The main file in "Block Country" v. 1.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
43 characters long description:
Set country or IP address to block website.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected436 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP27611436

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.20
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%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.05MB with 0.04MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png47.57KB17.76KB▼ 62.66%
block-ip.png2.94KB0.26KB▼ 91.30%