84% jwt-authentication-for-wp-rest-api

Code Review | JWT Authentication for WP REST API

WordPress plugin JWT Authentication for WP REST API scored84%from 54 tests.

About plugin

  • Plugin page: jwt-authenticatio...
  • Plugin version: 1.3.4
  • PHP compatiblity: 7.4.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-6.3.1
  • WordPress version: 6.3.1
  • First release: Sep 5, 2015
  • Latest release: Sep 11, 2023
  • Number of updates: 49
  • Update frequency: every 59.8 days
  • Top authors: Tmeister (100%)

Code review

54 tests

User reviews

40 reviews

Install metrics

40,000+ active /514,028 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.03MB] [CPU: ▲0.50ms] Passed 4 tests

A check of server-side resources used by JWT Authentication for WP REST API
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0340.27 ▼2.56
Dashboard /wp-admin3.33 ▲0.0353.90 ▲2.06
Posts /wp-admin/edit.php3.44 ▲0.0948.13 ▼2.16
Add New Post /wp-admin/post-new.php5.92 ▲0.03118.59 ▲12.52
Media Library /wp-admin/upload.php3.25 ▲0.0240.46 ▲4.64
JWT Authentication /wp-admin/options-general.php?page=jwt_authentication3.2334.21

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

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

Browser metrics Passed 4 tests

JWT Authentication for WP REST API: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,836 ▲7513.33 ▼1.211.61 ▼0.2339.59 ▼5.45
Dashboard /wp-admin2,228 ▲274.85 ▼1.09101.05 ▼33.5636.50 ▼6.86
Posts /wp-admin/edit.php2,101 ▲222.00 ▼0.0137.64 ▲1.5531.28 ▼1.05
Add New Post /wp-admin/post-new.php1,557 ▲1723.49 ▲5.30619.38 ▼0.6053.50 ▼0.37
Media Library /wp-admin/upload.php1,404 ▲44.29 ▲0.05102.99 ▼10.7645.45 ▼2.81
JWT Authentication /wp-admin/options-general.php?page=jwt_authentication9929.14184.3533.85

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
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 7 options
    • jwt_auth_admin_notice
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

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)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 102× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/OsclassInstaller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/TaoInstaller.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/jwt-authentication-for-wp-rest-api/includes/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
4 plugin tags: json web authentication, wp-api, wp-json, jwt

jwt-authentication-for-wp-rest-api/jwt-auth.php 85% from 13 tests

The main PHP script in "JWT Authentication for WP REST API" version 1.3.4 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("jwt-authentication-for-wp-rest-api.php" instead of "jwt-auth.php")

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 detected5,659 lines of code in 149 files:
LanguageFilesBlank linesComment linesLines of code
PHP1307591,8344,095
Markdown32020587
JSON500452
JavaScript61813299
YAML3313123
Sass1201102
CSS1001

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity3.93
▷ Minimum class complexity1.00
▷ Maximum class complexity74.00
Average method complexity2.78
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces5
Interfaces0
Traits0
Classes121
▷ Abstract classes10.83%
▷ Concrete classes12099.17%
▷ Final classes00.00%
Methods204
▷ Static methods4522.06%
▷ Public methods13666.67%
▷ Protected methods3416.67%
▷ Private methods3416.67%
Functions11
▷ Named functions436.36%
▷ Anonymous functions763.64%
Constants12
▷ Global constants00.00%
▷ Class constants12100.00%
▷ Public constants433.33%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG images were found in this plugin