84% badgeos-rest-api-addon

Code Review | BadgeOS REST API Addon

WordPress plugin BadgeOS REST API Addon scored84%from 54 tests.

About plugin

  • Plugin page: badgeos-rest-api-...
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.9.1
  • WordPress version: 6.3.1
  • First release: Aug 31, 2020
  • Latest release: Feb 28, 2022
  • Number of updates: 4
  • Update frequency: every 137.0 days
  • Top authors: learningtimes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /692 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.00MB] [CPU: ▼2.84ms] Passed 4 tests

An overview of server-side resources used by BadgeOS REST API Addon
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.69 ▼7.37
Dashboard /wp-admin3.31 ▲0.0054.81 ▲5.37
Posts /wp-admin/edit.php3.36 ▲0.0053.38 ▲3.02
Add New Post /wp-admin/post-new.php5.89 ▲0.0087.29 ▼12.36
Media Library /wp-admin/upload.php3.23 ▲0.0041.66 ▲6.58

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 21 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
bos_api_version
db_upgraded
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for BadgeOS REST API Addon
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲7013.18 ▼1.202.21 ▲0.2343.30 ▼1.13
Dashboard /wp-admin2,209 ▲184.83 ▼1.05108.15 ▲3.7937.91 ▼2.35
Posts /wp-admin/edit.php2,089 ▼02.13 ▲0.1240.61 ▲2.1735.97 ▲2.55
Add New Post /wp-admin/post-new.php1,533 ▲523.22 ▲5.04677.03 ▲13.9461.31 ▲10.84
Media Library /wp-admin/upload.php1,388 ▼04.23 ▲0.03102.05 ▼0.8346.14 ▲4.14

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • bos_api_version
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however 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
Please fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/badgeos-rest-api-addon/includes/api-widget.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

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: badgeos, badges, api, rest api

badgeos-rest-api-addon/badgeos-rest-api.php 85% from 13 tests

The main PHP file in "BadgeOS REST API Addon" ver. 1.1.0 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("badgeos-rest-api-addon.php" instead of "badgeos-rest-api.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected2,016 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP94116091,907
JavaScript39384
Markdown215024
CSS1001

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity36.00
▷ Minimum class complexity7.00
▷ Maximum class complexity79.00
Average method complexity5.52
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes112.50%
Methods62
▷ Static methods34.84%
▷ Public methods5995.16%
▷ Protected methods00.00%
▷ Private methods34.84%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants888.89%
▷ Class constants111.11%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
PNG images were not found in this plugin