84% api-bearer-auth

Code Review | API Bearer Auth

WordPress plugin API Bearer Auth scored84%from 54 tests.

About plugin

  • Plugin page: api-bearer-auth
  • Plugin version: 20200916...
  • PHP compatiblity: 5.4.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.3.1
  • WordPress version: 6.3.1
  • First release: Dec 1, 2017
  • Latest release: Sep 2, 2023
  • Number of updates: 34
  • Update frequency: every 61.8 days
  • Top authors: michielve (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

400+ active /21,405 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼1.50ms] Passed 4 tests

This is a short check of server-side resources used by API Bearer Auth
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0842.18 ▲1.16
Dashboard /wp-admin3.38 ▲0.0754.81 ▲3.84
Posts /wp-admin/edit.php3.49 ▲0.1447.45 ▼1.74
Add New Post /wp-admin/post-new.php5.96 ▲0.0887.06 ▼4.09
Media Library /wp-admin/upload.php3.30 ▲0.0736.57 ▼1.33

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 4 new files
Database: 1 new table, 6 new options
New tables
wp_user_tokens
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
widget_recent-posts
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for API Bearer Auth
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.23 ▼0.121.78 ▲0.1344.90 ▲0.35
Dashboard /wp-admin2,195 ▲155.63 ▲0.0189.90 ▼0.2139.63 ▼4.71
Posts /wp-admin/edit.php2,097 ▼32.02 ▲0.0135.40 ▼1.9035.84 ▼0.88
Add New Post /wp-admin/post-new.php1,535 ▲918.29 ▼4.60621.52 ▼41.1566.78 ▲5.75
Media Library /wp-admin/upload.php1,394 ▼64.21 ▲0.03105.50 ▼6.9442.44 ▼4.78

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

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 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_uninstall_hook() in wp-content/plugins/api-bearer-auth/api-bearer-auth.php:324

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
5 plugin tags: jwt-tokens, authentication, api, jwt, rest-api

api-bearer-auth/api-bearer-auth.php 85% from 13 tests

This is the main PHP file of "API Bearer Auth" version 20200916..., providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Text Domain: The text domain name should consist of only dashes and lowercase characters
  • Version: Plugin version number should only contain digits separated by dots (ex. "1.0.3" instead of "20200916...")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected380 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP380110380

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity19.00
▷ Minimum class complexity9.00
▷ Maximum class complexity29.00
Average method complexity2.44
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods25
▷ Static methods28.00%
▷ Public methods2080.00%
▷ Protected methods00.00%
▷ Private methods520.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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
There are no PNG files in this plugin