79% restrict-usernames

Code Review | Restrict Usernames

WordPress plugin Restrict Usernames scored79%from 54 tests.

About plugin

  • Plugin page: restrict-usernames
  • Plugin version: 3.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-4.9
  • WordPress version: 6.3.1
  • First release: Jul 29, 2009
  • Latest release: Jun 21, 2018
  • Number of updates: 18
  • Update frequency: every 183.9 days
  • Top authors: coffee2code (100%)

Code review

54 tests

User reviews

14 reviews

Install metrics

600+ active /22,860 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.19MB] [CPU: ▼5.84ms] Passed 4 tests

An overview of server-side resources used by Restrict Usernames
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2139.51 ▲1.04
Dashboard /wp-admin3.51 ▲0.1645.62 ▼13.27
Posts /wp-admin/edit.php3.63 ▲0.2746.04 ▲1.48
Add New Post /wp-admin/post-new.php6.09 ▲0.2085.17 ▼10.23
Media Library /wp-admin/upload.php3.44 ▲0.2034.41 ▼0.90
Name Restrictions /wp-admin/users.php?page=restrict-usernames/restrict-usernames.php3.5033.06

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 11 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

Restrict Usernames: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲8313.22 ▼1.431.90 ▲0.1843.47 ▼4.54
Dashboard /wp-admin2,213 ▲224.86 ▼1.11102.20 ▼4.7640.62 ▲2.59
Posts /wp-admin/edit.php2,093 ▲42.05 ▲0.0036.54 ▼0.8334.74 ▲0.32
Add New Post /wp-admin/post-new.php1,536 ▲723.34 ▲4.91654.13 ▲21.4661.31 ▲5.31
Media Library /wp-admin/upload.php1,392 ▲14.24 ▼0.0496.26 ▼6.9141.45 ▼4.44
Name Restrictions /wp-admin/users.php?page=restrict-usernames/restrict-usernames.php9911.7127.3739.38

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/restrict-usernames/tests/bootstrap.php
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/restrict-usernames/tests/bootstrap.php on line 17
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/restrict-usernames/tests/bootstrap.php on line 17

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
10 plugin tags: username, users, restrictions, privacy, coffee2code...

restrict-usernames/restrict-usernames.php Passed 13 tests

"Restrict Usernames" version 3.7's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
77 characters long description:
Restrict the usernames that new users may use when registering for your site.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected1,171 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP52515931,122
Bourne Shell17322
XML10014
Markdown114013

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity61.67
▷ Minimum class complexity2.00
▷ Maximum class complexity131.00
Average method complexity2.96
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes133.33%
▷ Concrete classes266.67%
▷ Final classes150.00%
Methods94
▷ Static methods88.51%
▷ Public methods8085.11%
▷ Protected methods1313.83%
▷ Private methods11.06%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
c2c_minilogo.png3.49KB1.91KB▼ 45.43%