84% watchtower

Code Review | Watchtower

WordPress plugin Watchtower scored84%from 54 tests.

About plugin

  • Plugin page: watchtower
  • Plugin version: 0.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.4.1
  • WordPress version: 6.3.1
  • First release: May 17, 2020
  • Latest release: May 28, 2020
  • Number of updates: 11
  • Update frequency: every 1.2 days
  • Top authors: MattGeri (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /586 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.12MB] [CPU: ▼1.05ms] Passed 4 tests

A check of server-side resources used by Watchtower
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0947.82 ▲5.29
Dashboard /wp-admin3.44 ▲0.1349.28 ▼2.87
Posts /wp-admin/edit.php3.55 ▲0.1956.21 ▲4.19
Add New Post /wp-admin/post-new.php6.02 ▲0.1395.98 ▼6.10
Media Library /wp-admin/upload.php3.36 ▲0.1337.60 ▲0.58

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

Analyzing filesystem and database footprints of this plugin
Please fix the following
  • You have illegally modified 1 file (4.00KB) outside of "wp-content/plugins/watchtower/" and "wp-content/uploads/"
    • (new file) wp-content/mgd_mirror/mgd_maximinodotpy-gitdown-test-repository
Filesystem: 31 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

Watchtower: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,044 ▲25813.23 ▼1.152.01 ▼0.1039.96 ▼4.20
Dashboard /wp-admin2,454 ▲2514.90 ▼1.0299.74 ▼14.9138.88 ▼3.46
Posts /wp-admin/edit.php2,333 ▲2332.02 ▲0.0242.51 ▲7.4534.17 ▼1.23
Add New Post /wp-admin/post-new.php1,540 ▼523.51 ▲0.10713.10 ▲22.5051.76 ▼6.17
Media Library /wp-admin/upload.php1,626 ▲2264.23 ▼0.0496.21 ▼15.1743.70 ▼2.93

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • watchtower_cache_keys
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • 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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 9× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Warning
      Use of undefined constant WATCHTOWER_URL - assumed 'WATCHTOWER_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/watchtower/includes/templates/admin/parts/onboard.php on line 15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Watchtower\\esc_html_e() in wp-content/plugins/watchtower/includes/templates/admin/parts/security.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Watchtower\\trailingslashit() in wp-content/plugins/watchtower/includes/config/config.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Watchtower\\Bootstrap' not found in wp-content/plugins/watchtower/includes/templates/admin/dashboard.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Watchtower\\esc_html_e() in wp-content/plugins/watchtower/includes/templates/admin/parts/onboard.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Watchtower\\trailingslashit() in wp-content/plugins/watchtower/includes/config/config.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Watchtower\\Bootstrap' not found in wp-content/plugins/watchtower/includes/templates/admin/settings.php:16
    • > PHP Fatal error
      Trait 'Watchtower\\Traits\\Singleton' not found in wp-content/plugins/watchtower/includes/classes/class-bootstrap.php on line 27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/watchtower/includes/templates/save-token.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 13 tag instead of maximum 10
You can look at the official readme.txt

watchtower/watchtower.php Passed 13 tests

Analyzing the main PHP file in "Watchtower" version 0.2
71 characters long description:
Uptime and performance auditing, monitoring and alerting for WordPress.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin1,785 lines of code in 28 files:
LanguageFilesBlank linesComment linesLines of code
PHP212915941,366
CSS1610274
JavaScript63411145

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity9.14
▷ Minimum class complexity2.00
▷ Maximum class complexity20.00
Average method complexity2.84
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces4
Interfaces0
Traits1
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods31
▷ Static methods412.90%
▷ Public methods2890.32%
▷ Protected methods39.68%
▷ Private methods00.00%
Functions11
▷ Named functions1090.91%
▷ Anonymous functions19.09%
Constants14
▷ Global constants214.29%
▷ Class constants1285.71%
▷ Public constants12100.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.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon.png10.82KB4.91KB▼ 54.67%
assets/images/logo.png5.07KB3.21KB▼ 36.66%