10% 2step-reviews-app

Code Review | 2 Step Reviews

WordPress plugin 2 Step Reviews scored 10% from 54 tests.

About plugin

  • Plugin page: 2step-reviews-app
  • Plugin version: 1.0.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-4.7
  • WordPress version: 5.9.2
  • First release: May 14, 2019
  • Latest release: Jun 5, 2019
  • Number of updates: 17
  • Update frequency: every 1.8 days
  • Top authors: ricardoalmira89 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 417 total downloads

Benchmarks

Plugin footprint 57% 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
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/2step-reviews-app/two-step-reviews-app.php+94
    date_default_timezone_set(): Timezone ID '' is invalid

Server metrics [RAM: ▼1.94MB] [CPU: ▼355.57ms] Passed 4 tests

A check of server-side resources used by 2 Step Reviews
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.43 ▼1.097.48 ▼49.78
Dashboard /wp-admin2.45 ▼0.967.23 ▼26.57
Posts /wp-admin/edit.php2.45 ▼1.207.29 ▼34.58
Add New Post /wp-admin/post-new.php2.45 ▼4.536.93 ▼1,294.10
Media Library /wp-admin/upload.php2.45 ▼0.856.78 ▼43.83
Reviews /wp-admin/admin.php?page=2step-reviews-app/show-reviews.php2.459.09
2Step /wp-admin/admin.php?page=2step-reviews-app/config-page.php2.457.82

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

A short overview of filesystem and database impact
Please fix the following
  • There were 1 file (0.00KB) illegally modified outside of "wp-content/plugins/2step-reviews-app/" and "wp-content/uploads/"
    • (new file) "wp-content/plugins/2step-reviews-app/assets/images/logo-256\303\227256.png"
Filesystem: 887 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for 2 Step Reviews
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,834 ▲11215.86 ▲0.186.26 ▲0.822.50 ▲0.25
Dashboard /wp-admin2,920 ▲596.14 ▼0.06118.74 ▼13.10182.05 ▲2.36
Posts /wp-admin/edit.php2,722 ▲373.13 ▼0.1268.21 ▼1.60154.33 ▲7.83
Add New Post /wp-admin/post-new.php1,697 ▼5515.62 ▼5.38410.74 ▼80.18191.15 ▼19.37
Media Library /wp-admin/upload.php1,732 ▲345.50 ▲0.03122.78 ▼31.21215.09 ▲19.41
Reviews /wp-admin/admin.php?page=2step-reviews-app/show-reviews.php9842.3751.6491.06
2Step /wp-admin/admin.php?page=2step-reviews-app/config-page.php1,3932.3854.80218.38

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/2step-reviews-app/two-step-reviews-app.php+94
    date_default_timezone_set(): Timezone ID '' is invalid

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These server-side errors were triggered
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > Notice in wp-content/plugins/2step-reviews-app/two-step-reviews-app.php+94
    date_default_timezone_set(): Timezone ID '' is invalid
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > Deprecated in wp-includes/class-wp-hook.php+307
    Non-static method Two_Step_Reviews_App::add_menu_admin() should not be called statically
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > Notice in wp-content/plugins/2step-reviews-app/config-page.php+10
    Undefined index: username
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > Notice in wp-content/plugins/2step-reviews-app/config-page.php+32
    Undefined index: action
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > User deprecated in wp-content/plugins/2step-reviews-app/vendor/twig/twig/lib/Twig/Loader/Filesystem.php+7
    Using the "Twig_Loader_Filesystem" class is deprecated since Twig version 2.7, use "Twig\Loader\FilesystemLoader" instead.
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > User deprecated in wp-content/plugins/2step-reviews-app/vendor/twig/twig/lib/Twig/Environment.php+7
    Using the "Twig_Environment" class is deprecated since Twig version 2.7, use "Twig\Environment" instead.
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > User deprecated in wp-content/plugins/2step-reviews-app/vendor/twig/twig/lib/Twig/Extension/Debug.php+7
    Using the "Twig_Extension_Debug" class is deprecated since Twig version 2.7, use "Twig\Extension\DebugExtension" instead.
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > Deprecated in wp-content/plugins/2step-reviews-app/vendor/twig/twig/src/Node/Node.php+43
    Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`
    • > GET request to /wp-admin/admin.php?page=2step-reviews-app/config-page.php
    • > User deprecated in wp-content/plugins/2step-reviews-app/vendor/twig/twig/lib/Twig/SimpleFilter.php+19
    Using the "Twig_SimpleFilter" class is deprecated since Twig version 2.7, use "Twig\TwigFilter" instead.

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
The following issues need your attention
  • 326× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/2step-reviews-app/vendor/guzzlehttp/promises/src/EachPromise.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\\TokenParser\\AbstractTokenParser' not found in wp-content/plugins/2step-reviews-app/vendor/twig/twig/src/TokenParser/FromTokenParser.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\\TokenParser\\AbstractTokenParser' not found in wp-content/plugins/2step-reviews-app/vendor/twig/twig/src/TokenParser/IfTokenParser.php:31
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/2step-reviews-app/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\\TokenParser\\AbstractTokenParser' not found in wp-content/plugins/2step-reviews-app/vendor/twig/twig/src/TokenParser/WithTokenParser.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/2step-reviews-app/vendor/composer/installers/src/Composer/Installers/CockpitInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/2step-reviews-app/vendor/composer/installers/src/Composer/Installers/KanboardInstaller.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Twig\ode\\Expression\\TestExpression' not found in wp-content/plugins/2step-reviews-app/vendor/twig/twig/src/Node/Expression/Test/DefinedTest.php:35
    • > PHP Fatal error
      Uncaught Error: Class 'Timber\\User' not found in wp-content/plugins/2step-reviews-app/vendor/timber/timber/lib/Integrations/CoAuthorsPlusUser.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/2step-reviews-app/vendor/composer/installers/src/Composer/Installers/AglInstaller.php:4

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 90% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Donate link: Please fix this invalid URI: ""
The official readme.txt is a good inspiration

2step-reviews-app/two-step-reviews-app.php 85% from 13 tests

Analyzing the main PHP file in "2 Step Reviews" version 1.0.1
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("2step-reviews-app.php" instead of "two-step-reviews-app.php")
  • Description: The description should be shorter than 140 characters (currently 197 characters long)

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
Please make sure to remedy the following
  • For security reasons, never distribute binary or executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/2step-reviews-app/vendor/bin/var-dump-server.bat
44,814 lines of code in 857 files:
LanguageFilesBlank linesComment linesLines of code
PHP6497,34015,14632,938
Markdown552,30706,334
reStructuredText922,0941,9342,729
JSON18001,602
XML173053529
Bourne Shell55815265
Twig93016213
YAML8342189
make1409
DOS Batch1004
CSS20472

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity6.84
▷ Minimum class complexity1.00
▷ Maximum class complexity172.00
Average method complexity2.61
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces52
Interfaces34
Traits2
Classes586
▷ Abstract classes152.56%
▷ Concrete classes57197.44%
▷ Final classes6010.51%
Methods2,307
▷ Static methods36615.86%
▷ Public methods1,90882.70%
▷ Protected methods1908.24%
▷ Private methods2099.06%
Functions301
▷ Named functions16554.82%
▷ Anonymous functions13645.18%
Constants134
▷ Global constants1410.45%
▷ Class constants12089.55%
▷ Public constants120100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/logo-256×256.png34.08KB8.68KB▼ 74.53%
media/icon.png0.79KB0.66KB▼ 16.79%