94% safe-staging

Code Review | Safe Staging

WordPress plugin Safe Staging scored 94% from 53 tests.

About plugin

  • Plugin page: safe-staging
  • Plugin version: 0.3.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.1
  • WordPress version: 5.8.1
  • First release: Feb 9, 2019
  • Latest release: Mar 23, 2019
  • Number of updates: 8
  • Update frequency: every 6.1 days
  • Top authors: ryanshoover (100%)

Code review

53 tests

User reviews

1 review

Install metrics

20+ active / 698 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼275.95ms] Passed 4 tests

Analyzing server-side resources used by Safe Staging
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.1228.36 ▲9.13
Dashboard /wp-admin3.07 ▲0.0240.84 ▼4.97
Posts /wp-admin/edit.php3.12 ▲0.0244.68 ▲2.51
Add New Post /wp-admin/post-new.php5.43 ▲0.0087.76 ▼1,088.09
Media Library /wp-admin/upload.php3.01 ▲0.0130.32 ▼13.25
Safe Staging /wp-admin/options-general.php?page=safe-staging3.0127.30

Server storage [IO: ▲0.07MB] [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: 26 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Safe Staging
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,735 ▲12916.05 ▲0.4911.56 ▲2.2749.99 ▲1.00
Dashboard /wp-admin2,976 ▲1266.21 ▲0.22134.28 ▲4.61100.02 ▲3.42
Posts /wp-admin/edit.php2,754 ▲512.70 ▲0.0064.05 ▲2.1494.54 ▲2.51
Add New Post /wp-admin/post-new.php1,671 ▼2,03618.85 ▲3.73346.35 ▼97.87102.26 ▼7.46
Media Library /wp-admin/upload.php1,730 ▼455.05 ▲0.03148.53 ▲0.71107.13 ▼9.89
Safe Staging /wp-admin/options-general.php?page=safe-staging1,0192.0954.3773.50

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not 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
Please take a closer look at the following
  • 11× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SafeStaging\\esc_html_e() in wp-content/plugins/safe-staging/templates/notice-production.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SafeStaging\\esc_html_e() in wp-content/plugins/safe-staging/templates/staging-notice.php:13
    • > PHP Warning
      Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in wp-content/plugins/safe-staging/inc/class-fake-phpmailer.php on line 18
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHWPINC/class-phpmailer.php' (include_path='.:/usr/share/php') in wp-content/plugins/safe-staging/inc/class-fake-phpmailer.php on line 18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SafeStaging\\esc_html_e() in wp-content/plugins/safe-staging/templates/notice-setup.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SafeStaging\\esc_html_e() in wp-content/plugins/safe-staging/templates/setup-notice.php:13
    • > PHP Warning
      require_once(ABSPATHWPINC/class-phpmailer.php): failed to open stream: No such file or directory in wp-content/plugins/safe-staging/inc/class-fake-phpmailer.php on line 18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SafeStaging\\plugin_dir_path() in wp-content/plugins/safe-staging/safe-staging.php:41
    • > PHP Fatal error
      Uncaught Error: Call to undefined function SafeStaging\\esc_html_e() in wp-content/plugins/safe-staging/templates/admin-page.php:12
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/safe-staging/inc/class-fake-phpmailer.php on line 18

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 Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
3 plugin tags: email, woocommerce, staging

safe-staging/safe-staging.php Passed 13 tests

The main PHP file in "Safe Staging" ver. 0.3.2 adds more information about the plugin and also serves as the entry point for this plugin
42 characters long description:
Disables user activities on a staging site

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin706 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
PHP18147362588
Markdown1400101
JSON20017

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity10.86
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.77
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods40
▷ Static methods717.50%
▷ Public methods3792.50%
▷ Protected methods25.00%
▷ Private methods12.50%
Functions5
▷ Named functions360.00%
▷ Anonymous functions240.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 1 test

Image compression Passed 1 test

PNG files should be compressed to save space and minimize bandwidth usage
No PNG files were detected