90% lightweight-js-snippet

Code Review | Lightweight JS Snippet

WordPress plugin Lightweight JS Snippet scored90%from 54 tests.

About plugin

  • Plugin page: lightweight-js-sn...
  • Plugin version: 1.2
  • PHP compatiblity: 5.7+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.0.2
  • WordPress version: 6.3.1
  • First release: Sep 9, 2022
  • Latest release: Oct 7, 2022
  • Number of updates: 3
  • Update frequency: every 9.7 days
  • Top authors: jonas.hjalmarsson (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /253 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▼0.21MB] [CPU: ▼16.97ms] Passed 4 tests

Analyzing server-side resources used by Lightweight JS Snippet
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0242.95 ▲3.34
Dashboard /wp-admin3.08 ▼0.2229.11 ▼25.28
Posts /wp-admin/edit.php3.22 ▼0.1435.55 ▼17.27
Add New Post /wp-admin/post-new.php5.46 ▼0.4382.30 ▼18.89
Media Library /wp-admin/upload.php3.17 ▼0.0629.32 ▼6.42
Lightweight JS snippet /wp-admin/options-general.php?page=jhljs-settings3.2333.16

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Lightweight JS Snippet
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲714.38 ▲0.861.84 ▼3.1845.09 ▼1.71
Dashboard /wp-admin2,202 ▲415.57 ▼0.0288.81 ▼15.7140.96 ▼6.20
Posts /wp-admin/edit.php2,101 ▼21.97 ▲0.0335.60 ▼4.2132.96 ▼8.53
Add New Post /wp-admin/post-new.php1,529 ▲323.37 ▼0.28675.70 ▲49.0455.31 ▲0.88
Media Library /wp-admin/upload.php1,401 ▲14.21 ▼0.00101.67 ▼3.7843.97 ▼0.47
Lightweight JS snippet /wp-admin/options-general.php?page=jhljs-settings9873.4678.1240.65

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
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
3 plugin tags: snippet, insert on one page, javascript

lightweight-js-snippet/lightweight-js-snippet.php Passed 13 tests

The principal PHP file in "Lightweight JS Snippet" v. 1.2 is loaded by WordPress automatically on each request
43 characters long description:
Add JS scipt to one or more pages or posts.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected126 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP23742108
JavaScript12018

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods133.33%
▷ Public methods266.67%
▷ Protected methods00.00%
▷ Private methods133.33%
Functions7
▷ Named functions685.71%
▷ Anonymous functions114.29%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected