63% oauth-client

Code Review | OAuth 2.0 client for SSO

WordPress plugin OAuth 2.0 client for SSO scored 63% from 54 tests.

About plugin

  • Plugin page: oauth-client
  • Plugin version: 1.11.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.9
  • WordPress version: 5.9.2
  • First release: Mar 5, 2018
  • Latest release: Jan 27, 2022
  • Number of updates: 58
  • Update frequency: every 24.6 days
  • Top authors: cyberlord92 (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

200+ active / 13,260 total downloads

Benchmarks

Plugin footprint 48% 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.61MB] [CPU: ▼299.30ms] Passed 4 tests

A check of server-side resources used by OAuth 2.0 client for SSO
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.18 ▲0.6764.39 ▲10.08
Dashboard /wp-admin4.02 ▲0.6141.30 ▼2.97
Posts /wp-admin/edit.php4.24 ▲0.6046.34 ▲1.26
Add New Post /wp-admin/post-new.php7.54 ▲0.57102.31 ▼1,198.82
Media Library /wp-admin/upload.php3.96 ▲0.6632.18 ▲3.33
Configure OAuth /wp-admin/admin.php?page=mo_oauth_settings3.8749.11
Advanced EVE Online Settings /wp-admin/admin.php?page=mo_oauth_eve_online_setup3.8630.66

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 59 new files
Database: no new tables, 8 new options
New WordPress options
mo_oauth_login_icon_custom_color
mo_oauth_login_icon_custom_boundary
mo_oauth_login_icon_custom_height
mo_oauth_login_icon_custom_width
mo_oauth_login_icon_custom_size
host_name
widget_mo_oauth_widget
mo_oauth_login_icon_space

Browser metrics Passed 4 tests

This is an overview of browser requirements for OAuth 2.0 client for SSO
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,835 ▲8116.11 ▲0.446.69 ▲0.662.18 ▼0.54
Dashboard /wp-admin2,931 ▲706.88 ▲0.67121.83 ▼14.40179.11 ▲17.05
Posts /wp-admin/edit.php2,738 ▲503.32 ▲0.0968.26 ▼2.47143.39 ▲1.06
Add New Post /wp-admin/post-new.php1,701 ▼5716.15 ▼5.19435.13 ▲16.55149.75 ▼15.61
Media Library /wp-admin/upload.php1,748 ▲476.00 ▲0.48129.30 ▼15.50201.61 ▲9.51
Configure OAuth /wp-admin/admin.php?page=mo_oauth_settings3,7593.5081.88192.07
Advanced EVE Online Settings /wp-admin/admin.php?page=mo_oauth_eve_online_setup1,0542.8459.81136.96

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Uninstall procedure validation failed for this plugin
    • > Compile error in wp-content/plugins/oauth-client/manage-avatar.php+2
    Cannot redeclare set_avatar() (previously declared in wp-content/plugins/oauth-client/manage-avatar.php:2)
  • The plugin did not uninstall correctly, leaving 59 files (1.79MB) in the plugin directory
    • (new file) class-customer.php
    • (new file) addons/images/login-form.png
    • (new file) addons/images/learndash-icon.png
    • (new file) addons/images/attribute-icon.png
    • (new file) addons/class-mo-oauth-client-addons.php
    • (new file) addons/images/buddypress-logo.png
    • (new file) addons/images/scim-icon.png
    • (new file) addons/images/member-login.png
    • (new file) addons/images/page-restriction.png
    • (new file) addons/images/report-icon.png
    • ...
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_mo_oauth_widget
    • mo_oauth_login_icon_custom_boundary
    • recovery_mode_email_last_sent
    • mo_oauth_login_icon_custom_width
    • mo_oauth_login_icon_space
    • mo_oauth_login_icon_custom_height
    • mo_oauth_login_icon_custom_color
    • mo_oauth_login_icon_custom_size

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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 take a closer look at the following
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/oauth-client/manage-avatar.php:341
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/oauth-client/class-mo-oauth-widget.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/oauth-client/manage-avatar.php:341
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/oauth-client/class-mo-oauth-widget.php:7

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: No descriptions were found for these screenshots #3, #4, #5, #6 in oauth-client/assets to your readme.txt
The official readme.txt might help

oauth-client/mo_oauth_settings.php 92% from 13 tests

"OAuth 2.0 client for SSO" version 1.11.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("oauth-client.php" instead of "mo_oauth_settings.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin9,870 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
PHP116833915,480
CSS10150443,493
SVG100685
JavaScript81238212

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 115)
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity36.17
▷ Minimum class complexity1.00
▷ Maximum class complexity129.00
Average method complexity5.49
▷ Minimum method complexity1.00
▷ Maximum method complexity115.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods47
▷ Static methods48.51%
▷ Public methods4493.62%
▷ Protected methods00.00%
▷ Private methods36.38%
Functions41
▷ Named functions41100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
20 PNG files occupy 0.21MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
addons/images/member-login.png2.43KB1.47KB▼ 39.62%
addons/images/scim-icon.png4.06KB3.53KB▼ 12.95%
addons/images/buddypress-logo.png3.39KB1.91KB▼ 43.64%
images/miniorange.png0.44KB0.35KB▼ 18.61%
images/flags16.png61.80KB19.90KB▼ 67.79%