10% passbyme-two-factor-authentication

Code Review | PassBy[ME] Two-Factor Authentication

WordPress plugin PassBy[ME] Two-Factor Authentication scored10%from 54 tests.

About plugin

  • Plugin page: passbyme-two-fact...
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.2-4.6.1
  • WordPress version: 6.3.1
  • First release: Jun 29, 2017
  • Latest release: Jun 29, 2017
  • Number of updates: 9
  • Update frequency: every 1.6 days
  • Top authors: passbyme (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /860 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Please fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Warning in wp-content/plugins/passbyme-two-factor-authentication/src/Microsec/PassByME/Plugin/Admin/Functions.php+23
    Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future version of PHP)

Server metrics [RAM: ▼0.01MB] [CPU: ▼8.69ms] Passed 4 tests

Server-side resources used by PassBy[ME] Two-Factor Authentication
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0037.14 ▼6.03
Dashboard /wp-admin3.31 ▼0.0444.98 ▼16.25
Posts /wp-admin/edit.php3.36 ▲0.0046.94 ▲0.32
Add New Post /wp-admin/post-new.php5.89 ▲0.0088.46 ▼12.79
Media Library /wp-admin/upload.php3.23 ▲0.0036.03 ▲2.10

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 484 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

PassBy[ME] Two-Factor Authentication: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.66 ▼0.731.78 ▼0.1243.91 ▲1.92
Dashboard /wp-admin2,206 ▲184.90 ▼0.97112.80 ▲0.7541.90 ▲0.29
Posts /wp-admin/edit.php2,089 ▼01.99 ▲0.0340.02 ▲3.8834.14 ▲0.44
Add New Post /wp-admin/post-new.php1,533 ▲523.23 ▲4.85608.40 ▼10.7949.38 ▼6.23
Media Library /wp-admin/upload.php1,391 ▲34.31 ▲0.1295.01 ▼8.5842.85 ▼2.56

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/passbyme-two-factor-authentication/src/Microsec/PassByME/Plugin/Admin/Functions.php+23
    Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' (this will throw an Error in a future version of PHP)
  • The plugin did not uninstall correctly, leaving 484 files (4.84MB) in the plugin directory
    • (new file) src/Microsec/PassByME/Log/Logger.php
    • (new file) src/Microsec/PassByME/Plugin/Admin/Functions.php
    • (new file) src/Microsec/PassByME/Plugin/Admin/Actions.php
    • (new file) src/Microsec/PassByME/Autoloader.php
    • (new file) src/Microsec/PassByME/Log/ILogger.php
    • (new file) passbyme-2factor-authentication.php
    • (new file) readme.txt
    • (new file) gpl-2.0.txt
    • (new file) src/Microsec/PassByME/Methods/Management.php
    • (new file) src/Microsec/PassByME/Methods/Messaging.php
    • ...
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • recovery_mode_email_last_sent
    • can_compress_scripts

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
The smoke test was a success, however most plugin functionality was not tested

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
Please fix the following items
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'PassByME\\TwoFactor\\Send2FaRequest' not found in wp-content/plugins/passbyme-two-factor-authentication/src/Microsec/PassByME/Methods/Management.php:44
    • > PHP Fatal error
      Uncaught Error: Class 'PassByME\\TwoFactor\\Send2FaRequest' not found in wp-content/plugins/passbyme-two-factor-authentication/src/Microsec/PassByME/Methods/Messaging.php:45
    • > PHP Fatal error
      Uncaught Error: Interface 'PassByME\\Log\\ILogger' not found in wp-content/plugins/passbyme-two-factor-authentication/src/Microsec/PassByME/Log/Logger.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'PassByME\\TwoFactor\\Curl' not found in wp-content/plugins/passbyme-two-factor-authentication/src/Microsec/PassByME/TwoFactor/Send2FaRequest.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 22 tag instead of maximum 10
You can take inspiration from this readme.txt

passbyme-two-factor-authentication/passbyme-2factor-authentication.php 92% from 13 tests

The entry point to "PassBy[ME] Two-Factor Authentication" version 1.0.1 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("passbyme-two-factor-authentication.php" instead of "passbyme-2factor-authentication.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Almost there! Just fix the following issues
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .ps1 - Windows PowerShell Cmdlet in Windows
      • wp-content/plugins/passbyme-two-factor-authentication/static/bower_components/bootstrap/nuget/MyGet.ps1
67,203 lines of code in 441 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript27410,08612,93942,932
CSS4721942512,300
LESS711,1751,5425,590
JSON15003,446
PHP222788452,372
SVG100288
Markdown71010160
XML20056
YAML1111655
PowerShell1224

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity9.58
▷ Minimum class complexity1.00
▷ Maximum class complexity57.00
Average method complexity1.97
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces7
Interfaces1
Traits0
Classes18
▷ Abstract classes00.00%
▷ Concrete classes18100.00%
▷ Final classes00.00%
Methods171
▷ Static methods84.68%
▷ Public methods12774.27%
▷ Protected methods2112.28%
▷ Private methods2313.45%
Functions13
▷ Named functions17.69%
▷ Anonymous functions1292.31%
Constants0
▷ Global constants00.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
14 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
static/bower_components/jquery-ui/themes/base/images/ui-icons_ffffff_256x240.png6.33KB4.18KB▼ 33.99%
static/bower_components/datatables/media/images/sort_asc.png0.16KB0.25KB0.00%
static/img/pbm-logo.png6.74KB3.03KB▼ 55.09%
static/bower_components/datatables/media/images/sort_both.png0.20KB0.29KB0.00%
static/bower_components/jquery-ui/themes/base/images/ui-icons_777777_256x240.png6.94KB4.18KB▼ 39.78%