93% json-cache

Code Review | JSON Cache Plugin

WordPress plugin JSON Cache Plugin scored 93% from 54 tests.

About plugin

  • Plugin page: json-cache
  • Plugin version: v0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.4
  • WordPress version: 5.9.2
  • First release: Mar 6, 2014
  • Latest release: Mar 7, 2014
  • Number of updates: 3
  • Update frequency: every 0.3 days
  • Top authors: thibautdelille (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,094 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.01MB] [CPU: ▼300.95ms] Passed 4 tests

A check of server-side resources used by JSON Cache Plugin
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0452.08 ▼2.36
Dashboard /wp-admin3.44 ▲0.0332.98 ▲0.10
Posts /wp-admin/edit.php3.67 ▲0.0337.80 ▲1.08
Add New Post /wp-admin/post-new.php6.91 ▼0.06102.10 ▼1,199.78
Media Library /wp-admin/upload.php3.32 ▲0.0324.38 ▼1.77

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 9 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

JSON Cache Plugin: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,815 ▲7115.88 ▲0.316.06 ▼0.402.40 ▲0.19
Dashboard /wp-admin2,911 ▲576.00 ▼0.19117.35 ▼18.16178.03 ▲17.02
Posts /wp-admin/edit.php2,708 ▲143.14 ▼0.1064.66 ▼1.39144.69 ▼2.32
Add New Post /wp-admin/post-new.php1,681 ▲2019.02 ▲2.55425.27 ▼25.12175.76 ▲16.24
Media Library /wp-admin/upload.php1,715 ▲175.49 ▼0.06129.06 ▼29.28204.85 ▲13.75

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
This plugin's uninstaller ran successfully

Smoke tests 75% 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 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
Please fix the following items
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/json-cache/jsoncache.php:126

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 on the user side

Optimizations

Plugin configuration 90% 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
Attributes that need to be fixed:
  • Screenshots: Screenshot #1 (Menu Setting of JSON Cache to generate the cache. assets/screenshot-1.png) image required
The official readme.txt is a good inspiration

json-cache/jsoncache.php 85% from 13 tests

The principal PHP file in "JSON Cache Plugin" v. v0.1 is loaded by WordPress automatically on each request
The following require your attention:
  • Version: The plugin version was missing
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("json-cache.php" instead of "jsoncache.php")

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
No dangerous file extensions were detected236 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP13672191
Markdown115045

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.48
Average class complexity32.00
▷ Minimum class complexity32.00
▷ Maximum class complexity32.00
Average method complexity3.21
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods14
▷ Static methods00.00%
▷ Public methods1178.57%
▷ Protected methods00.00%
▷ Private methods321.43%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
5 PNG files occupy 0.06MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
check-icon.png1.17KB1.17KB0.08%
assets/screenshot-1.png58.94KB18.91KB▼ 67.91%
cache_icon.png1.59KB0.80KB▼ 49.69%
delete-icon.png0.41KB0.44KB0.00%
warning.png1.92KB1.66KB▼ 13.47%