73% hammy

Code Review | Hammy

WordPress plugin Hammy scored 73% from 54 tests.

About plugin

  • Plugin page: hammy
  • Plugin version: 1.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-3.8.1
  • WordPress version: 6.3.1
  • First release: Jun 26, 2012
  • Latest release: Feb 16, 2014
  • Number of updates: 35
  • Update frequency: every 17.1 days
  • Top authors: Noel_Tock (100%)

Code review

54 tests

User reviews

16 reviews

Install metrics

400+ active / 64,868 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▼0.76MB] [CPU: ▼35.75ms] Passed 4 tests

Analyzing server-side resources used by Hammy
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.66 ▲0.2025.36 ▼17.71
Dashboard /wp-admin3.19 ▼0.1223.43 ▼31.52
Posts /wp-admin/edit.php3.19 ▼0.1727.70 ▼19.76
Add New Post /wp-admin/post-new.php3.19 ▼2.7024.55 ▼74.01
Media Library /wp-admin/upload.php3.19 ▼0.0422.65 ▼14.10

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 54 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
can_compress_scripts
db_upgraded
widget_recent-comments
hammy_options
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for Hammy
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,908 ▲15113.64 ▼0.675.20 ▲2.8437.15 ▼5.12
Dashboard /wp-admin2,220 ▲324.87 ▼0.98108.14 ▲11.3840.14 ▼5.32
Posts /wp-admin/edit.php2,103 ▲142.10 ▲0.0639.13 ▼1.3933.86 ▼3.79
Add New Post /wp-admin/post-new.php1,609 ▲7323.68 ▲0.53608.20 ▼1.6653.38 ▲0.53
Media Library /wp-admin/upload.php1,396 ▲144.26 ▲0.08100.78 ▲4.0542.40 ▼1.85

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Warning in wp-includes/class-wp-hook.php+310
    call_user_func_array() expects parameter 1 to be a valid callback, function 'hammy_add_page' not found or invalid function name
  • Zombie WordPress options detected upon uninstall: 7 options
    • db_upgraded
    • hammy_options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
The following issues need your attention
  • 26× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/hammy/WPThumb/tests/bootstrap.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Thumb_UnitTestCase' not found in wp-content/plugins/hammy/WPThumb/tests/defaultImageTest.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/hammy/WPThumb/wpthumb.shortcodes.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Thumb_UnitTestCase' not found in wp-content/plugins/hammy/WPThumb/tests/backgroundFillAutoTest.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hammy/WPThumb/wpthumb.crop-from-position.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Thumb_UnitTestCase' not found in wp-content/plugins/hammy/WPThumb/tests/backgroundFillTest.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/hammy/hammy.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Thumb_UnitTestCase' not found in wp-content/plugins/hammy/WPThumb/tests/cropTest.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Thumb_UnitTestCase' not found in wp-content/plugins/hammy/WPThumb/tests/resizeTest.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/hammy/WPThumb/wpthumb.php:28

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)
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Screenshots: Add an image for screenshot #1 (Options Screen)
  • Tags: Please reduce the number of tags, currently 15 tag instead of maximum 10
You can take inspiration from this readme.txt

hammy/hammy.php Passed 13 tests

The main PHP script in "Hammy" version 1.5.1 is automatically included on every request by WordPress
76 characters long description:
Creates adaptive images for your content area with breakpoints that you set.

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
Success! There were no dangerous files found in this plugin2,111 lines of code in 37 files:
LanguageFilesBlank linesComment linesLines of code
PHP239354461,655
JavaScript5189108232
CSS212697
Markdown337063
XML20025
Bourne Shell17322
YAML15017

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity5.20
▷ Minimum class complexity1.00
▷ Maximum class complexity63.00
Average method complexity1.91
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes19
▷ Abstract classes00.00%
▷ Concrete classes19100.00%
▷ Final classes00.00%
Methods93
▷ Static methods22.15%
▷ Public methods8793.55%
▷ Protected methods00.00%
▷ Private methods66.45%
Functions42
▷ Named functions4197.62%
▷ Anonymous functions12.38%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
10 PNG files occupy 2.31MB with 1.66MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
WPThumb/tests/images/checked.png50.64KB0.09KB▼ 99.82%
WPThumb/tests/images/black.png0.41KB0.09KB▼ 78.30%
WPThumb/tests/images/white-10.png0.19KB0.08KB▼ 56.77%
WPThumb/tests/images/boxed.png0.21KB0.09KB▼ 56.40%
WPThumb/tests/images/UpperCase.png21.51KB6.98KB▼ 67.57%