93% add-javascript-attributes

Code Review | Add JavaScript attributes

WordPress plugin Add JavaScript attributes scored 93% from 54 tests.

About plugin

  • Plugin page: add-javascript-at...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-4.7
  • WordPress version: 5.9.2
  • First release: Mar 20, 2017
  • Latest release: Mar 20, 2017
  • Number of updates: 4
  • Update frequency: every 6.2 days
  • Top authors: ifourkuldeep1 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 544 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼0.00MB] [CPU: ▼308.49ms] Passed 4 tests

Analyzing server-side resources used by Add JavaScript attributes
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0263.74 ▲7.04
Dashboard /wp-admin3.42 ▲0.0237.09 ▼45.15
Posts /wp-admin/edit.php3.66 ▲0.0275.72 ▲34.36
Add New Post /wp-admin/post-new.php6.89 ▼0.0797.91 ▼1,202.12
Media Library /wp-admin/upload.php3.31 ▲0.0233.33 ▲6.26

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 5 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Add JavaScript attributes
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,792 ▲3815.58 ▼0.165.91 ▼0.292.25 ▼0.30
Dashboard /wp-admin2,898 ▲406.11 ▼0.09117.11 ▼31.31152.44 ▼16.41
Posts /wp-admin/edit.php2,710 ▲163.24 ▲0.0065.33 ▼30.00138.01 ▼14.73
Add New Post /wp-admin/post-new.php1,711 ▲5022.37 ▲6.17435.84 ▲15.60181.53 ▲22.85
Media Library /wp-admin/upload.php1,718 ▲265.47 ▼0.03141.52 ▼2.01184.46 ▼2.01

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 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-javascript-attributes/add-javascript-attributes.php:13

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Screenshots: These screenshots require images: #1 (Front-end of JavaScript attribute added.), #2 (Admin side JavaScript attributes added.)
The official readme.txt might help

add-javascript-attributes/add-javascript-attributes.php 92% from 13 tests

The primary PHP file in "Add JavaScript attributes" version 1.0 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

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
Good job! No executable or dangerous file extensions detected98 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1111098

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.06
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.07MB with 0.05MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-256x256.png34.22KB16.54KB▼ 51.66%
assets/icon-128x128.png11.51KB5.73KB▼ 50.21%
(invalid) assets/banner-772x250.png27.44KB0.00KB▼ 100.00%