84% user-agent-blocker

Code Review | User Agent Blocker

WordPress plugin User Agent Blocker scored84%from 54 tests.

About plugin

  • Plugin page: user-agent-blocker
  • Plugin version: 1.0.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.2.1
  • WordPress version: 6.3.1
  • First release: May 31, 2019
  • Latest release: Jun 1, 2019
  • Number of updates: 3
  • Update frequency: every 0.3 days
  • Top authors: adhitya03 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,168 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼8.96ms] Passed 4 tests

Analyzing server-side resources used by User Agent Blocker
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0040.09 ▼4.59
Dashboard /wp-admin3.31 ▲0.0152.76 ▼7.16
Posts /wp-admin/edit.php3.36 ▲0.0149.94 ▼2.63
Add New Post /wp-admin/post-new.php5.89 ▲0.0186.06 ▼18.35
Media Library /wp-admin/upload.php3.23 ▲0.0135.54 ▼5.73
User Agent Blocker /wp-admin/tools.php?page=user-agent-blocker3.2038.30

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for User Agent Blocker
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲714.72 ▲0.371.82 ▼0.0244.71 ▲4.68
Dashboard /wp-admin2,202 ▲285.63 ▲0.0885.33 ▼6.2137.96 ▲0.28
Posts /wp-admin/edit.php2,104 ▲11.94 ▼0.1333.82 ▼10.3634.86 ▼3.59
Add New Post /wp-admin/post-new.php1,529 ▲323.64 ▲0.57642.49 ▼38.5760.03 ▲1.26
Media Library /wp-admin/upload.php1,401 ▲44.22 ▲0.0497.29 ▼30.9044.95 ▼11.52
User Agent Blocker /wp-admin/tools.php?page=user-agent-blocker9631.9922.8840.66

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
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/user-agent-blocker/user-agent-blocker.php on line 26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
4 plugin tags: htaccess, user-agent, bad robot, block

user-agent-blocker/user-agent-blocker.php 92% from 13 tests

The main file in "User Agent Blocker" v. 1.0.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected242 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP13144242

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.22
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%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected