94% add-html-javascript-and-css-to-head

Code Review | Add HTML, JavaScript and CSS to <head>

WordPress plugin Add HTML, JavaScript and CSS to <head> scored 94% from 54 tests.

About plugin

  • Plugin page: add-html-javascri...
  • Plugin version: 0.1.2
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-4.9
  • WordPress version: 5.9.2
  • First release: Jun 29, 2018
  • Latest release: Jun 30, 2018
  • Number of updates: 15
  • Update frequency: every 0.1 days
  • Top authors: rvbakker (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 525 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.03MB] [CPU: ▼273.47ms] Passed 4 tests

An overview of server-side resources used by Add HTML, JavaScript and CSS to <head>
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.0555.09 ▲1.36
Dashboard /wp-admin3.47 ▲0.0634.56 ▲1.22
Posts /wp-admin/edit.php3.70 ▲0.0542.16 ▲2.31
Add New Post /wp-admin/post-new.php6.93 ▼0.04154.96 ▼1,098.33
Media Library /wp-admin/upload.php3.35 ▲0.0527.32 ▲1.88

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

Browser metrics Passed 4 tests

Checking browser requirements for Add HTML, JavaScript and CSS to <head>
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,783 ▲2916.20 ▲0.555.61 ▼0.842.52 ▼0.04
Dashboard /wp-admin2,912 ▲516.15 ▼0.01122.39 ▼14.00172.66 ▼45.35
Posts /wp-admin/edit.php2,708 ▲233.36 ▲0.1363.20 ▲0.38143.77 ▲1.53
Add New Post /wp-admin/post-new.php1,773 ▲2116.98 ▼4.54419.44 ▼55.60189.77 ▲11.05
Media Library /wp-admin/upload.php1,715 ▲205.56 ▲0.03154.04 ▼4.49235.98 ▲30.20

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function AddHtmlJavaScriptAndCssToHead\\is_admin() in wp-content/plugins/add-html-javascript-and-css-to-head/add-html-to-head.php:298

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% 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
Please fix the following attributes: The official readme.txt is a good inspiration

add-html-javascript-and-css-to-head/add-html-to-head.php 92% from 13 tests

"Add HTML, JavaScript and CSS to <head>" version 0.1.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("add-html-javascript-and-css-to-head.php" instead of "add-html-to-head.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected282 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP13028282

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.08
Average class complexity3.00
▷ Minimum class complexity3.00
▷ Maximum class complexity3.00
Average method complexity1.29
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods7
▷ Static methods00.00%
▷ Public methods7100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

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