84% rest-api-oauth1

Code Review | WordPress REST API - OAuth 1.0a Server

WordPress plugin WordPress REST API - OAuth 1.0a Server scored84%from 54 tests.

About plugin

  • Plugin page: rest-api-oauth1
  • Plugin version: 0.4.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.4
  • WordPress version: 6.3.1
  • First release: Oct 6, 2016
  • Latest release: Dec 1, 2023
  • Number of updates: 11
  • Update frequency: every 237.5 days
  • Top authors: spacedmonkey (72.73%)joehoyle (27.27%)rachelbaker (18.18%)

Code review

54 tests

User reviews

6 reviews

Install metrics

10,000+ active /103,008 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
Installer ran successfully

Server metrics [RAM: ▲0.26MB] [CPU: ▼3.16ms] Passed 4 tests

This is a short check of server-side resources used by WordPress REST API - OAuth 1.0a Server
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.72 ▲0.2638.33 ▼3.17
Dashboard /wp-admin3.57 ▲0.2748.10 ▼0.91
Posts /wp-admin/edit.php3.69 ▲0.3349.21 ▲3.17
Add New Post /wp-admin/post-new.php6.15 ▲0.2781.57 ▼11.03
Media Library /wp-admin/upload.php3.50 ▲0.2735.93 ▲2.46
Applications /wp-admin/users.php?page=rest-oauth1-apps3.5536.08

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 132 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for WordPress REST API - OAuth 1.0a Server
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,794 ▲4714.25 ▼0.511.57 ▼0.2137.24 ▼6.55
Dashboard /wp-admin2,199 ▲225.61 ▼0.0490.44 ▼17.2940.32 ▼7.20
Posts /wp-admin/edit.php2,104 ▲41.94 ▼0.0639.47 ▲0.6136.28 ▲0.37
Add New Post /wp-admin/post-new.php1,529 ▲323.30 ▲0.09661.95 ▼15.8143.78 ▼11.81
Media Library /wp-admin/upload.php1,404 ▲14.18 ▼0.1299.41 ▲2.1342.57 ▲0.66
Applications /wp-admin/users.php?page=rest-oauth1-apps9212.0425.4425.84

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 107× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/LavaLiteInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/SMFInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/rest-api-oauth1/vendor/composer/installers/src/Composer/Installers/VgmcpInstaller.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 96% from 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: api, json, rest-api, rest

rest-api-oauth1/oauth-server.php 92% from 13 tests

"WordPress REST API - OAuth 1.0a Server" version 0.4.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("rest-api-oauth1.php" instead of "oauth-server.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 detected4,516 lines of code in 124 files:
LanguageFilesBlank linesComment linesLines of code
PHP1238631,5564,356
JSON100160

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity4.29
▷ Minimum class complexity1.00
▷ Maximum class complexity99.00
Average method complexity2.93
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes113
▷ Abstract classes21.77%
▷ Concrete classes11198.23%
▷ Final classes00.00%
Methods198
▷ Static methods4020.20%
▷ Public methods13970.20%
▷ Protected methods4924.75%
▷ Private methods105.05%
Functions21
▷ Named functions1466.67%
▷ Anonymous functions733.33%
Constants10
▷ Global constants00.00%
▷ Class constants10100.00%
▷ Public constants10100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
4 PNG files occupy 0.07MB with 0.05MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/banner-772x250.png21.82KB8.54KB▼ 60.88%
assets/icon-256x256.png20.37KB6.80KB▼ 66.61%
assets/icon-128x128.png9.88KB3.72KB▼ 62.36%
assets/banner-1544x500.png23.26KB8.48KB▼ 63.53%