84% json-api-auth

Code Review | JSON API Auth

WordPress plugin JSON API Auth scored84%from 54 tests.

About plugin

  • Plugin page: json-api-auth
  • Plugin version: 2.9.1
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.4.1
  • WordPress version: 6.3.1
  • First release: Dec 17, 2013
  • Latest release: Nov 9, 2023
  • Number of updates: 61
  • Update frequency: every 59.3 days
  • Top authors: parorrey (100%)

Code review

54 tests

User reviews

11 reviews

Install metrics

1,000+ active /70,047 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
Install script ran successfully

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

An overview of server-side resources used by JSON API Auth
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0035.22 ▼4.27
Dashboard /wp-admin3.31 ▼0.0446.82 ▼15.02
Posts /wp-admin/edit.php3.36 ▲0.0044.69 ▼5.74
Add New Post /wp-admin/post-new.php5.89 ▲0.0083.09 ▼0.42
Media Library /wp-admin/upload.php3.23 ▲0.0035.98 ▲1.91

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

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

Browser metrics Passed 4 tests

A check of browser resources used by JSON API Auth
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲5914.10 ▼0.031.51 ▼0.0541.66 ▲1.90
Dashboard /wp-admin2,208 ▲275.52 ▼0.1891.54 ▼18.6242.01 ▼4.76
Posts /wp-admin/edit.php2,116 ▲192.02 ▲0.0733.12 ▼6.4934.88 ▼1.41
Add New Post /wp-admin/post-new.php1,542 ▲1323.41 ▲0.10691.72 ▲6.4550.51 ▼5.51
Media Library /wp-admin/upload.php1,413 ▲134.19 ▼0.02102.08 ▼7.7041.73 ▼5.93

Uninstaller [IO: ▲0.00MB] [DB: ▲0.07MB] 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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
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
Almost there! Just fix the following items
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/json-api-auth/json-api-auth.php on line 15
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/json-api-auth/json-api-auth.php on line 15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/json-api-auth/json-api-auth.php:28
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/json-api-auth/json-api-auth.php on line 15

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 Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
4 plugin tags: json api, authenticate user, wordpress user authentication, api

json-api-auth/json-api-auth.php Passed 13 tests

This is the main PHP file of "JSON API Auth" version 2.9.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
60 characters long description:
Extends the JSON API Plugin for RESTful user authentiocation

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected150 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP23918150

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity18.00
▷ Minimum class complexity18.00
▷ Maximum class complexity18.00
Average method complexity5.25
▷ Minimum method complexity3.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
No PNG images were found in this plugin