84% png-compress

Code Review | Png Compress

WordPress plugin Png Compress scored84%from 54 tests.

About plugin

  • Plugin page: png-compress
  • Plugin version: 1.03
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Aug 19, 2020
  • Latest release: Oct 31, 2023
  • Number of updates: 16
  • Update frequency: every 72.9 days
  • Top authors: Katsushi Kawamori (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /1,062 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.07MB] [CPU: ▼3.12ms] Passed 4 tests

This is a short check of server-side resources used by Png Compress
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0837.71 ▼4.83
Dashboard /wp-admin3.38 ▲0.0844.36 ▼5.26
Posts /wp-admin/edit.php3.44 ▲0.0748.42 ▲2.88
Add New Post /wp-admin/post-new.php5.97 ▲0.0788.29 ▼3.90
Media Library /wp-admin/upload.php3.31 ▲0.0734.68 ▲1.53
PNG Compress /wp-admin/upload.php?page=pngcompress-settings3.2828.18

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 6 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
pngcompress
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

Png Compress: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲714.32 ▲0.091.64 ▼0.4140.26 ▼5.11
Dashboard /wp-admin2,193 ▲135.61 ▼0.0393.84 ▼5.3539.97 ▼1.85
Posts /wp-admin/edit.php2,107 ▲72.02 ▲0.0238.83 ▲2.3436.36 ▼0.74
Add New Post /wp-admin/post-new.php1,531 ▲323.50 ▲0.47642.53 ▼118.8148.88 ▼12.44
Media Library /wp-admin/upload.php1,404 ▲14.20 ▼0.0397.03 ▼2.4942.97 ▲0.27
PNG Compress /wp-admin/upload.php?page=pngcompress-settings1,0252.0123.0127.34

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/png-compress/lib/class-pngcompress.php:45
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/png-compress/lib/class-pngcompressadmin.php:36
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/png-compress/lib/class-pngcompress.php:45

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
4 plugin tags: compress, png, media, upload

png-compress/pngcompress.php 92% from 13 tests

The main PHP file in "Png Compress" ver. 1.03 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("png-compress.php" instead of "pngcompress.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected357 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP473171339
JavaScript161818

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity20.50
▷ Minimum class complexity17.00
▷ Maximum class complexity24.00
Average method complexity3.79
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods14
▷ Static methods00.00%
▷ Public methods857.14%
▷ Protected methods00.00%
▷ Private methods642.86%
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

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin