84% disable-json-api

Code Review | Disable REST API

WordPress plugin Disable REST API scored84%from 54 tests.

About plugin

  • Plugin page: disable-json-api
  • Plugin version: 1.8
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.3
  • WordPress version: 6.3.1
  • First release: Oct 3, 2014
  • Latest release: Sep 14, 2023
  • Number of updates: 18
  • Update frequency: every 181.6 days
  • Top authors: dmchale (100%)

Code review

54 tests

User reviews

36 reviews

Install metrics

90,000+ active /576,494 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

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

A check of server-side resources used by Disable REST API
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0742.18 ▼1.90
Dashboard /wp-admin3.39 ▲0.0950.71 ▼1.87
Posts /wp-admin/edit.php3.51 ▲0.1549.20 ▼9.21
Add New Post /wp-admin/post-new.php5.98 ▲0.0988.74 ▼9.77
Media Library /wp-admin/upload.php3.32 ▲0.0937.04 ▼0.24
Disable REST API /wp-admin/options-general.php?page=disable_rest_api_settings4.6738.76

Server storage [IO: ▲0.04MB] [DB: ▲0.01MB] 67% from 3 tests

A short overview of filesystem and database impact
Just a few items left to fix
  • The plugin illegally modified 1 file (4.00KB) outside of "wp-content/plugins/disable-json-api/" and "wp-content/uploads/"
    • (new file) wp-content/mgd_mirror/mgd_maximinodotpy-gitdown-test-repository
Filesystem: 18 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
disable_rest_api_options
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Disable REST API
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,843 ▲5713.23 ▼1.142.10 ▲0.1345.92 ▲3.72
Dashboard /wp-admin2,222 ▲165.80 ▼0.0299.58 ▼2.9138.76 ▼5.12
Posts /wp-admin/edit.php2,107 ▲41.99 ▼0.1333.96 ▼9.2731.86 ▼2.78
Add New Post /wp-admin/post-new.php1,562 ▲3118.39 ▼4.87649.90 ▲47.0073.08 ▲17.78
Media Library /wp-admin/upload.php1,395 ▼84.29 ▲0.0799.59 ▼4.1542.12 ▼2.32
Disable REST API /wp-admin/options-general.php?page=disable_rest_api_settings1,7982.0924.7248.51

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
Almost there! Just fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/disable-json-api/admin.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
6 plugin tags: admin, api, json, rest, disable...

disable-json-api/disable-json-api.php 92% from 13 tests

The main PHP file in "Disable REST API" ver. 1.8 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Description: Keep the plugin description shorter than 140 characters (currently 156 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin511 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP8197247427
Markdown219046
JavaScript25024
CSS10013
YAML1001

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity15.75
▷ Minimum class complexity8.00
▷ Maximum class complexity28.00
Average method complexity2.58
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods34
▷ Static methods1338.24%
▷ Public methods2367.65%
▷ Protected methods00.00%
▷ Private methods1132.35%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin