84% better-resource-hints

Code Review | Better Resource Hints

WordPress plugin Better Resource Hints scored84%from 54 tests.

About plugin

  • Plugin page: better-resource-h...
  • Plugin version: 1.1.3
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.0.3
  • WordPress version: 6.3.1
  • First release: May 10, 2018
  • Latest release: Feb 12, 2019
  • Number of updates: 10
  • Update frequency: every 27.8 days
  • Top authors: alexmacarthur (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

400+ active /9,886 total downloads


Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.10MB] [CPU: ▼7.25ms] Passed 4 tests

A check of server-side resources used by Better Resource Hints
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1137.58 ▼5.90
Dashboard /wp-admin3.41 ▲0.0750.87 ▼10.54
Posts /wp-admin/edit.php3.53 ▲0.1748.48 ▼4.81
Add New Post /wp-admin/post-new.php6.01 ▲0.1387.33 ▼7.74
Media Library /wp-admin/upload.php3.34 ▲0.1140.66 ▲4.57
Better Resource Hints /wp-admin/options-general.php?page=better_resource_hints3.3134.63

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 34 new files
Database: no new tables, 6 new options
New WordPress options

Browser metrics Passed 4 tests

Checking browser requirements for Better Resource Hints
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,802 ▲4114.35 ▼0.022.40 ▼0.2045.55 ▲4.40
Dashboard /wp-admin2,206 ▲295.64 ▲0.0484.71 ▼3.9842.81 ▲0.19
Posts /wp-admin/edit.php2,108 ▲52.03 ▲0.0139.03 ▼1.8033.27 ▼3.65
Add New Post /wp-admin/post-new.php1,275 ▼25113.62 ▼9.54269.52 ▼395.2432.16 ▼20.06
Media Library /wp-admin/upload.php1,411 ▲114.20 ▲0.02109.11 ▲4.4949.11 ▲4.22
Better Resource Hints /wp-admin/options-general.php?page=better_resource_hints1,3052.1723.4245.27

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments

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
Even though no errors were found, this is by no means 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 fix the following items
  • 12× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function BetterResourceHints\\plugin_dir_path() in wp-content/plugins/better-resource-hints/src/inc/promo.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'BetterResourceHints\\Utilities' not found in wp-content/plugins/better-resource-hints/src/inc/preconnect-assets.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'BetterResourceHints\\Utilities' not found in wp-content/plugins/better-resource-hints/src/inc/preloaded-scripts.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'BetterResourceHints\\Utilities' not found in wp-content/plugins/better-resource-hints/src/inc/preloaded-styles.php:4
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/plugin.php' (include_path='.:/usr/share/php') in wp-content/plugins/better-resource-hints/better-resource-hints.php on line 14
    • > PHP Fatal error
      Uncaught Error: Class 'BetterResourceHints\\Utilities' not found in wp-content/plugins/better-resource-hints/src/inc/prefetched-server-push.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'BetterResourceHints\\Utilities' not found in wp-content/plugins/better-resource-hints/src/inc/preconnect-server-push.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'BetterResourceHints\\Utilities' not found in wp-content/plugins/better-resource-hints/src/inc/preloaded-server-push.php:4
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/better-resource-hints/better-resource-hints.php on line 14
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/better-resource-hints/better-resource-hints.php on line 14

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test


Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Screenshots: These screenshots need descriptions #1, #2, #3 in better-resource-hints/assets to your readme.txt
  • Donate link: Invalid url: "paypal.me/alexmacarthur"
You can look at the official readme.txt

better-resource-hints/better-resource-hints.php Passed 13 tests

The main PHP file in "Better Resource Hints" ver. 1.1.3 adds more information about the plugin and also serves as the entry point for this plugin
90 characters long description:
Easy preloading, prefetching, HTTP/2 server pushing, and more for your CSS and JavaScript.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin979 lines of code in 31 files:
LanguageFilesBlank linesComment linesLines of code

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity6.86
▷ Minimum class complexity1.00
▷ Maximum class complexity20.00
Average method complexity2.24
▷ Minimum method complexity1.00
▷ Maximum method complexity14.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
▷ Static methods824.24%
▷ Public methods3193.94%
▷ Protected methods00.00%
▷ Private methods26.06%
▷ Named functions00.00%
▷ Anonymous functions00.00%
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There are no PNG files in this plugin