78% token2-two-factor-authentication

Code Review | Token2 Two Factor Authentication

WordPress plugin Token2 Two Factor Authentication scored78%from 54 tests.

About plugin

  • Plugin page: token2-two-factor...
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-4.2.2
  • WordPress version: 6.3.1
  • First release: Jun 5, 2015
  • Latest release: Jun 6, 2015
  • Number of updates: 13
  • Update frequency: every 0.1 days
  • Top authors: token2 (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /699 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼6.81ms] Passed 4 tests

Analyzing server-side resources used by Token2 Two Factor Authentication
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0141.12 ▼0.57
Dashboard /wp-admin3.32 ▲0.0247.87 ▼6.48
Posts /wp-admin/edit.php3.37 ▲0.0250.58 ▼4.58
Add New Post /wp-admin/post-new.php5.90 ▲0.0286.19 ▼15.59
Media Library /wp-admin/upload.php3.25 ▲0.0238.56 ▲1.19
token2 /wp-admin/options-general.php?page=token23.1932.63

Server storage [IO: ▲0.22MB] [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: 12 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Token2 Two Factor Authentication
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.74 ▲0.451.69 ▲0.0241.83 ▲0.52
Dashboard /wp-admin2,199 ▲195.61 ▼0.0287.05 ▼2.2938.56 ▼4.45
Posts /wp-admin/edit.php2,104 ▲12.00 ▼0.1140.93 ▼1.1136.00 ▼4.95
Add New Post /wp-admin/post-new.php1,529 ▲322.99 ▼0.52638.96 ▼74.4459.21 ▲3.28
Media Library /wp-admin/upload.php1,398 ▼54.18 ▼0.0193.93 ▼5.5245.43 ▲2.85
token2 /wp-admin/options-general.php?page=token28912.0123.0526.45

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=token2
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=token2
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.

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
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/token2-two-factor-authentication/token2.php:161

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need your attention:
  • Tags: Please delete some tags, you are using 11 tag instead of maximum 10
You can take inspiration from this readme.txt

token2-two-factor-authentication/token2.php 85% from 13 tests

The entry point to "Token2 Two Factor Authentication" version 1.0.1 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("token2-two-factor-authentication.php" instead of "token2.php")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected1,335 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP33595071,239
CSS10052
JavaScript26026
Markdown115018

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity80.50
▷ Minimum class complexity11.00
▷ Maximum class complexity150.00
Average method complexity3.89
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods55
▷ Static methods23.64%
▷ Public methods4378.18%
▷ Protected methods814.55%
▷ Private methods47.27%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.14MB with 0.11MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/phone-icon.png1.11KB0.35KB▼ 68.68%
assets/images/step1-image.png73.79KB10.85KB▼ 85.30%
assets/screenshot-1.png66.65KB8.50KB▼ 87.24%