89% add-admin-javascript

Code Review | Add Admin JavaScript

WordPress plugin Add Admin JavaScript scored 89% from 54 tests.

About plugin

  • Plugin page: add-admin-javascript
  • Plugin version: 2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.7
  • WordPress version: 5.9.2
  • First release: Dec 5, 2011
  • Latest release: May 8, 2021
  • Number of updates: 20
  • Update frequency: every 172.9 days
  • Top authors: coffee2code (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

3,000+ active / 32,279 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.18MB] [CPU: ▼296.26ms] Passed 4 tests

This is a short check of server-side resources used by Add Admin JavaScript
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.6553.68 ▲36.03
Dashboard /wp-admin3.62 ▲0.2138.58 ▲3.20
Posts /wp-admin/edit.php3.84 ▲0.2038.19 ▲0.54
Add New Post /wp-admin/post-new.php7.08 ▲0.1194.44 ▼1,190.39
Media Library /wp-admin/upload.php3.49 ▲0.1927.86 ▲1.62
Admin JavaScript /wp-admin/options-general.php?page=add-admin-javascript/add-admin-javascript.php3.4924.83

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 14 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Add Admin JavaScript
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,777 ▲2315.67 ▲0.106.31 ▼0.192.65 ▲0.11
Dashboard /wp-admin2,883 ▲296.10 ▼0.04118.31 ▼19.27155.86 ▼3.84
Posts /wp-admin/edit.php2,693 ▲43.24 ▲0.0064.22 ▼0.77143.17 ▲2.49
Add New Post /wp-admin/post-new.php1,761 ▲321.42 ▼0.06433.81 ▼15.19156.80 ▼0.60
Media Library /wp-admin/upload.php1,703 ▲25.50 ▼0.03155.03 ▲16.00205.81 ▲24.55
Admin JavaScript /wp-admin/options-general.php?page=add-admin-javascript/add-admin-javascript.php1,4184.46118.67180.45

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 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

SRP 0% 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
Please take a closer look at the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/add-admin-javascript/tests/phpunit/bootstrap.php
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/tests/phpunit/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/add-admin-javascript/tests/phpunit/bootstrap.php on line 19
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/tests/phpunit/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/add-admin-javascript/tests/phpunit/bootstrap.php on line 19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
7 plugin tags: javascript, js, customization, script, coffee2code...

add-admin-javascript/add-admin-javascript.php Passed 13 tests

The principal PHP file in "Add Admin JavaScript" v. 2.0 is loaded by WordPress automatically on each request
115 characters long description:
Interface for easily defining additional JavaScript (inline and/or by URL) to be added to all administration pages.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin1,790 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP63946671,424
Markdown3560331
Bourne Shell16221
XML10014

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity48.75
▷ Minimum class complexity3.00
▷ Maximum class complexity140.00
Average method complexity2.46
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes125.00%
▷ Concrete classes375.00%
▷ Final classes133.33%
Methods133
▷ Static methods86.02%
▷ Public methods12090.23%
▷ Protected methods139.77%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants360.00%
▷ Class constants240.00%
▷ Public constants2100.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
c2c_minilogo.png3.49KB1.91KB▼ 45.43%