83% login-with-rocket-chat

Code Review | Login with Rocket Chat

WordPress plugin Login with Rocket Chat scored 83% from 54 tests.

About plugin

  • Plugin page: login-with-rocket...
  • Plugin version: 2.2.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.2-5.9
  • WordPress version: 5.9.2
  • First release: Mar 16, 2020
  • Latest release: Feb 2, 2022
  • Number of updates: 11
  • Update frequency: every 62.8 days
  • Top authors: cyberlord92 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active / 955 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
This plugin's installer ran successfully

Server metrics [RAM: ▼0.45MB] [CPU: ▼313.26ms] Passed 4 tests

An overview of server-side resources used by Login with Rocket Chat
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.04 ▲0.5262.65 ▲5.27
Dashboard /wp-admin3.88 ▲0.4737.07 ▼4.37
Posts /wp-admin/edit.php4.10 ▲0.4641.58 ▼12.95
Add New Post /wp-admin/post-new.php3.70 ▼3.2730.55 ▼1,234.59
Media Library /wp-admin/upload.php3.82 ▲0.5229.37 ▼1.12

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 151 new files
Database: 8 new tables, no new options
New tables
wp_moos_oauth_users
wp_moos_oauth_public_keys
wp_moos_oauth_scopes
wp_moos_oauth_authorized_apps
wp_moos_oauth_clients
wp_moos_oauth_access_tokens
wp_moos_oauth_refresh_tokens
wp_moos_oauth_authorization_codes

Browser metrics Passed 4 tests

This is an overview of browser requirements for Login with Rocket Chat
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,791 ▲4916.01 ▲0.465.71 ▼0.622.29 ▲0.02
Dashboard /wp-admin2,926 ▲666.24 ▲0.21123.08 ▼5.43181.89 ▲10.82
Posts /wp-admin/edit.php2,713 ▲273.15 ▼0.0977.67 ▲8.75145.58 ▼58.39
Add New Post /wp-admin/post-new.php1,730 ▲7316.65 ▼1.57333.46 ▼88.08234.46 ▲75.30
Media Library /wp-admin/upload.php1,726 ▲285.62 ▲0.14175.72 ▲33.78233.74 ▲40.87

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin does not fully uninstall, leaving 8 tables in the database
    • wp_moos_oauth_access_tokens
    • wp_moos_oauth_authorization_codes
    • wp_moos_oauth_refresh_tokens
    • wp_moos_oauth_authorized_apps
    • wp_moos_oauth_public_keys
    • wp_moos_oauth_clients
    • wp_moos_oauth_scopes
    • wp_moos_oauth_users

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
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 56× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\Controller\\RocketchatResourceControllerInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/Controller/ResourceController.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\Storage\\AuthorizationCodeInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/Storage/Memory.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\Controller\\RocketchatAuthorizeControllerInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/Controller/AuthorizeController.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\ClientAssertionType\\ClientAssertionTypeInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/ClientAssertionType/HttpBasic.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\Controller\\RocketchatResourceControllerInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/Server.php:44
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/login-with-rocket-chat/pointers.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\ResponseInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/Response.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\ResponseType\\ResponseTypeInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/OpenID/ResponseType/CodeIdTokenInterface.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\GrantType\\GrantTypeInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/AuthorizationCode.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'OAuth2\\GrantType\\GrantTypeInterface' not found in wp-content/plugins/login-with-rocket-chat/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php:21

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 87% from 29 tests

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Add descriptions for screenshots #0, #0, #0 in login-with-rocket-chat/assets to your readme.txt
  • Screenshots: Add an image for screenshot #4 (Other configurations)
The official readme.txt might help

login-with-rocket-chat/mo_oauth_settings.php 85% from 13 tests

"Login with Rocket Chat" version 2.2.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 157 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("login-with-rocket-chat.php" instead of "mo_oauth_settings.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected12,017 lines of code in 119 files:
LanguageFilesBlank linesComment linesLines of code
PHP921,7962,2078,855
CSS8161361,642
JSON300885
JavaScript61831342
Markdown1300135
Twig48077
XML22039
YAML20036
HTML1506

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 104)
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity12.67
▷ Minimum class complexity1.00
▷ Maximum class complexity117.00
Average method complexity2.84
▷ Minimum method complexity1.00
▷ Maximum method complexity104.00
Code structure
Namespaces16
Interfaces34
Traits0
Classes53
▷ Abstract classes00.00%
▷ Concrete classes53100.00%
▷ Final classes00.00%
Methods628
▷ Static methods111.75%
▷ Public methods55087.58%
▷ Protected methods579.08%
▷ Private methods213.34%
Functions48
▷ Named functions4287.50%
▷ Anonymous functions612.50%
Constants14
▷ Global constants00.00%
▷ Class constants14100.00%
▷ Public constants14100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
8 PNG files occupy 0.11MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/flags16.png61.80KB19.90KB▼ 67.79%
images/fblogin.png4.05KB2.65KB▼ 34.40%
images/googlelogin.png2.94KB1.91KB▼ 35.23%
images/miniorange.png0.44KB0.35KB▼ 18.61%
images/tick.png28.84KB12.74KB▼ 55.81%