72% smart-protect

Code Review | Smart Protect

WordPress plugin Smart Protect scored 72% from 54 tests.

About plugin

  • Plugin page: smart-protect
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Nov 12, 2021
  • Latest release: Mar 20, 2022
  • Number of updates: 18
  • Update frequency: every 7.2 days
  • Top authors: kalanikochs (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active / 530 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲4.94MB] [CPU: ▲22.43ms] Passed 4 tests

An overview of server-side resources used by Smart Protect
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /8.75 ▲5.2964.04 ▲22.99
Dashboard /wp-admin8.77 ▲5.4771.38 ▲21.47
Posts /wp-admin/edit.php8.77 ▲5.4177.48 ▲27.70
Add New Post /wp-admin/post-new.php9.49 ▲3.60112.16 ▲17.55
Media Library /wp-admin/upload.php8.77 ▲5.5466.35 ▲30.83
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.7756.26

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 243 new files
Database: no new tables, 10 new options
New WordPress options
can_compress_scripts
fs_active_plugins
db_upgraded
fs_accounts
widget_recent-comments
fs_debug_mode
theysaidso_admin_options
fs_gdpr
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Smart Protect
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,865 ▲10813.52 ▼0.702.13 ▼0.2328.47 ▼19.54
Dashboard /wp-admin2,242 ▲544.91 ▼1.00103.61 ▼8.2739.37 ▼2.59
Posts /wp-admin/edit.php2,122 ▲331.99 ▼0.0642.31 ▲2.5240.12 ▲5.39
Add New Post /wp-admin/post-new.php1,537 ▲322.57 ▼0.46618.31 ▼23.7265.53 ▲13.35
Media Library /wp-admin/upload.php1,424 ▲364.23 ▲0.01103.20 ▲3.9043.10 ▼0.80
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,0651.7125.4227.37

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/smart-protect/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • Zombie WordPress options detected upon uninstall: 10 options
    • fs_active_plugins
    • widget_theysaidso_widget
    • fs_debug_mode
    • fs_accounts
    • fs_gdpr
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts

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

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 24× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      Use of undefined constant MGRG41194___SMART_PROTECT_ABSPATH - assumed 'MGRG41194___SMART_PROTECT_ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/smart-protect/includes/admin/views/dashboard.php on line 7
    • > PHP Fatal error
      Uncaught Error: Interface 'ReallySimpleJWT\\Interfaces\\Decode' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/src/Decode.php:13
    • > PHP Fatal error
      Uncaught Error: Interface 'ReallySimpleJWT\\Interfaces\\Secret' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/src/Secret.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/tests/Unit/ParseTest.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'ReallySimpleJWT\\Interfaces\\Validator' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/src/Helper/Validator.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/tests/Unit/Encoders/EncodeHs256Test.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/tests/Integration/BuildParseTest.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/tests/Integration/BuildValidateTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/tests/Unit/Helper/Base64Test.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/smart-protect/vendor/rbdwllr/reallysimplejwt/tests/Unit/TokensTest.php:14

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 errors were detected

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 81% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: These screenshots need descriptions #3, #4 in smart-protect/assets to your readme.txt
  • Requires php: The plugin version is formatted incorrectly
  • Requires at least: The plugin version is formatted incorrectly
You can take inspiration from this readme.txt

smart-protect/sm-lite-protect.php 85% from 13 tests

"Smart Protect" version 1.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("smart-protect.php" instead of "sm-lite-protect.php")
  • Text Domain: The text domain name must use dashes instead of underscores, and it must be lowercase

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin36,381 lines of code in 197 files:
LanguageFilesBlank linesComment linesLines of code
PHP1648,24916,93434,261
JavaScript77367842
Markdown22300571
CSS143515300
Sass2280181
JSON400138
XML21057
YAML27031

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
These items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,910)
Cyclomatic complexity
Average complexity per logical line of code0.56
Average class complexity48.10
▷ Minimum class complexity1.00
▷ Maximum class complexity2,910.00
Average method complexity3.92
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces12
Interfaces4
Traits2
Classes81
▷ Abstract classes22.47%
▷ Concrete classes7997.53%
▷ Final classes00.00%
Methods1,449
▷ Static methods18612.84%
▷ Public methods1,10075.91%
▷ Protected methods151.04%
▷ Private methods33423.05%
Functions106
▷ Named functions9993.40%
▷ Anonymous functions76.60%
Constants137
▷ Global constants10072.99%
▷ Class constants3727.01%
▷ Public constants3491.89%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/smart-protect.png3.85KB3.48KB▼ 9.54%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%