83% push-authenticator

Code Review | Woocommerce 2 Factor Authenticator

WordPress plugin Woocommerce 2 Factor Authenticator scored 83% from 54 tests.

About plugin

  • Plugin page: push-authenticator
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.9.1
  • WordPress version: 5.9.2
  • First release: Mar 16, 2017
  • Latest release: Mar 1, 2022
  • Number of updates: 7
  • Update frequency: every 258.1 days
  • Top authors: cyberlord92 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,333 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲1.67MB] [CPU: ▼286.98ms] Passed 4 tests

An overview of server-side resources used by Woocommerce 2 Factor Authenticator
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /5.21 ▲1.6962.89 ▲11.89
Dashboard /wp-admin5.11 ▲1.7143.06 ▲8.62
Posts /wp-admin/edit.php5.34 ▲1.7044.91 ▲10.10
Add New Post /wp-admin/post-new.php8.60 ▲1.61102.12 ▼1,177.75
Media Library /wp-admin/upload.php4.99 ▲1.7034.68 ▲11.13

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 59 new files
Database: no new tables, 15 new options
New WordPress options
mo2f_enable_mobile_support
mo2f_msg_counter
mo2f_enable_xmlrpc
mo2f_login_policy
mo2fa_contributor
mo2f_activate_plugin
mo2fa_author
mo2f_auth_methods_for_users
mo2f_enable_forgotphone
mo2f_custom_plugin_name
...

Browser metrics Passed 4 tests

Woocommerce 2 Factor Authenticator: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,808 ▲8615.84 ▲0.136.05 ▲0.122.27 ▲0.20
Dashboard /wp-admin2,921 ▲606.15 ▼0.01120.51 ▼13.17186.55 ▲14.62
Posts /wp-admin/edit.php2,717 ▲293.12 ▼0.1272.58 ▲7.89145.67 ▲4.06
Add New Post /wp-admin/post-new.php1,771 ▲11021.04 ▲3.85450.80 ▲56.92154.55 ▲0.36
Media Library /wp-admin/upload.php1,721 ▲235.52 ▼0.01128.19 ▼6.64203.38 ▲23.19

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin does not fully uninstall, leaving 1 option in the database
    • mo2f_enable_xmlrpc

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/push-authenticator/miniorange_2_factor_settings.php:1784
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_get_current_user() in wp-content/plugins/push-authenticator/upgrade.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function mo2f_check_if_registered_with_miniorange() in wp-content/plugins/push-authenticator/miniorange_2_factor_demo.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function mo2f_is_customer_registered() in wp-content/plugins/push-authenticator/miniorange_2_factor_frontend_shortcode.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 37 tag instead of maximum 10
The official readme.txt is a good inspiration

push-authenticator/miniorange_2_factor_settings.php 92% from 13 tests

The principal PHP file in "Woocommerce 2 Factor Authenticator" v. 1.1.0 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("push-authenticator.php" instead of "miniorange_2_factor_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
There were no executable files found in this plugin14,709 lines of code in 38 files:
LanguageFilesBlank linesComment linesLines of code
PHP191,62724312,268
CSS823092,174
JavaScript11613267

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Please tend to the following items
  • Method cyclomatic complexity should be reduced to less than 100 (currently 282)
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity113.00
▷ Minimum class complexity7.00
▷ Maximum class complexity401.00
Average method complexity9.06
▷ Minimum method complexity1.00
▷ Maximum method complexity282.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods125
▷ Static methods75.60%
▷ Public methods11995.20%
▷ Protected methods00.00%
▷ Private methods64.80%
Functions79
▷ Named functions79100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants240.00%
▷ Class constants360.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
17 PNG files occupy 0.32MB with 0.11MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/images/card.png59.80KB58.49KB▼ 2.19%
includes/images/wrong.png12.14KB6.37KB▼ 47.51%
includes/images/vertical_line.png2.55KB1.35KB▼ 47.14%
includes/images/playStore.png7.98KB2.62KB▼ 67.13%
includes/images/landline_sprite.png0.89KB0.81KB▼ 9.64%