87% snapid-two-factor-authentication

Code Review | SnapID Two-Factor Authentication

WordPress plugin SnapID Two-Factor Authentication scored 87% from 54 tests.

About plugin

  • Plugin page: snapid-two-factor...
  • Plugin version: 2.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-5.4
  • WordPress version: 5.8.1
  • First release: Aug 6, 2015
  • Latest release: Apr 16, 2020
  • Number of updates: 44
  • Update frequency: every 39.0 days
  • Top authors: ckilaru (84.09%)mauteri (18.18%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active / 2,114 total downloads

Benchmarks

Plugin footprint 99% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.26MB] [CPU: ▲343.59ms] 50% from 4 tests

An overview of server-side resources used by SnapID Two-Factor Authentication
The following require your attention
  • CPU: Try to keep total CPU usage under 500.00ms (currently 1,325.01ms on /wp-admin/options-general.php?page=snapid)
  • Extra CPU: Extra CPU usage should be kept under 200.00ms (currently 343.59ms on /wp-admin/options-general.php?page=snapid)
PageMemory (MB)CPU Time (ms)
Home /3.06 ▲0.2235.58 ▼5.49
Dashboard /wp-admin3.38 ▲0.33701.50 ▲651.38
Posts /wp-admin/edit.php3.43 ▲0.32689.77 ▲641.39
Add New Post /wp-admin/post-new.php5.68 ▲0.25753.84 ▲87.08
Media Library /wp-admin/upload.php3.27 ▲0.26978.93 ▲937.86
SnapID™ /wp-admin/options-general.php?page=snapid3.291,325.01

Server storage [IO: ▲0.61MB] [DB: ▲0.00MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
These are issues you should consider
  • The plugin illegally modified 2 files (0.26KB) outside of "wp-content/plugins/snapid-two-factor-authentication/" and "wp-content/uploads/"
    • (new file) wp-admin/cookie.txt
    • (new file) cookie.txt
Filesystem: 37 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for SnapID Two-Factor Authentication
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,780 ▲20816.05 ▲0.4110.33 ▲0.7049.84 ▼9.40
Dashboard /wp-admin3,029 ▲1015.97 ▼0.02151.83 ▼18.43118.89 ▲3.19
Posts /wp-admin/edit.php2,794 ▲552.84 ▲0.1377.01 ▲2.7593.88 ▼3.29
Add New Post /wp-admin/post-new.php1,719 ▲3618.69 ▼0.06401.14 ▲2.27138.73 ▲17.63
Media Library /wp-admin/upload.php1,860 ▲535.00 ▼0.03139.90 ▼17.72121.50 ▼9.73
SnapID™ /wp-admin/options-general.php?page=snapid2,7505.90107.73106.38

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
This plugin's uninstaller ran successfully

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
The following issues need your attention
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/snapid-two-factor-authentication/templates/uninstall.php
  • 8× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/snapid-two-factor-authentication/templates/message.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/snapid-two-factor-authentication/templates/auth_modal.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/snapid-two-factor-authentication/templates/login_form.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/snapid-two-factor-authentication/templates/settings_page.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_create_nonce() in wp-content/plugins/snapid-two-factor-authentication/templates/profile_hidden_fields.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/snapid-two-factor-authentication/templates/profile.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/snapid-two-factor-authentication/snapid.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/snapid-two-factor-authentication/templates/settings.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% 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
Attributes that require attention:
  • Tags: Please delete some tags, you are using 14 tag instead of maximum 10
You can take inspiration from this readme.txt

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

The entry point to "SnapID Two-Factor Authentication" version 2.0.2 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 208 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("snapid-two-factor-authentication.php" instead of "snapid.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected1,943 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
PHP122417901,305
JavaScript4558330
CSS4540307
Markdown1001

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity40.25
▷ Minimum class complexity2.00
▷ Maximum class complexity145.00
Average method complexity3.15
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods73
▷ Static methods11.37%
▷ Public methods6791.78%
▷ Protected methods00.00%
▷ Private methods68.22%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants10100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
7 PNG files occupy 0.05MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
jquery-modal/close.png1.87KB1.74KB▼ 6.60%
images/SnapID_button.png13.67KB6.51KB▼ 52.38%
images/SnapID-Register-Button2x.png8.63KB4.48KB▼ 48.09%
images/SnapIDLogo.png12.06KB6.41KB▼ 46.87%
images/SnapID-Signin-Button.png3.85KB2.23KB▼ 42.03%