78% attachment-usage

Code Review | Attachment Usage

WordPress plugin Attachment Usage scored78%from 54 tests.

About plugin

  • Plugin page: attachment-usage
  • Plugin version: 1.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.5.1
  • WordPress version: 6.3.1
  • First release: Jul 7, 2020
  • Latest release: Oct 9, 2020
  • Number of updates: 13
  • Update frequency: every 7.3 days
  • Top authors: konstk (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /755 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.79MB] [CPU: ▲0.30ms] Passed 4 tests

An overview of server-side resources used by Attachment Usage
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.22 ▲0.7643.24 ▼2.93
Dashboard /wp-admin4.11 ▲0.8157.73 ▲7.85
Posts /wp-admin/edit.php4.17 ▲0.8154.08 ▲9.48
Add New Post /wp-admin/post-new.php6.70 ▲0.8188.40 ▼13.20
Media Library /wp-admin/upload.php4.02 ▲0.7950.20 ▲9.60
Attachment Usage Settings /wp-admin/upload.php?page=attachment-usage-page4.0438.89

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 119 new files
Database: no new tables, 12 new options
New WordPress options
widget_recent-comments
au_display_usage_listview
au_filter_by_usage
au_is_rating_dismissed
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
au_color_status
au_attachment_usage_found
...

Browser metrics Passed 4 tests

An overview of browser requirements for Attachment Usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,064 ▲29315.47 ▲1.114.85 ▲2.8338.80 ▼5.73
Dashboard /wp-admin2,359 ▲1776.53 ▲0.63137.66 ▲27.1041.84 ▼0.14
Posts /wp-admin/edit.php2,268 ▲1823.33 ▲1.3250.36 ▲12.2533.52 ▼1.14
Add New Post /wp-admin/post-new.php1,686 ▲15822.09 ▲3.73627.93 ▼16.8437.35 ▼17.45
Media Library /wp-admin/upload.php1,430 ▲394.08 ▼0.1083.68 ▼15.5648.82 ▲3.29
Attachment Usage Settings /wp-admin/upload.php?page=attachment-usage-page1,0943.0642.5627.76

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/attachment-usage/admin/partials/attachment-usage-admin-display.php
    • > /wp-content/plugins/attachment-usage/public/partials/attachment-usage-public-display.php
  • 45× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\Core\\Finder\\Abstract_Attachment_Finder' not found in wp-content/plugins/attachment-usage/admin/classes/finder/post-content-attachment-finder.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'AttachmentUsage\\Interfaces\\IFactory' not found in wp-content/plugins/attachment-usage/admin/settings_page/elements/validators/validator-factory.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\Core\\ContentHolder\\Abstract_Content_Holder' not found in wp-content/plugins/attachment-usage/admin/classes/content_holder/content-holder.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\Core\\ResultBuilder\\Abstract_Attachment_Result_Builder' not found in wp-content/plugins/attachment-usage/admin/classes/result_builder/thumbnail-attachment-result-builder.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\Core\\Finder\\Abstract_Attachment_Finder' not found in wp-content/plugins/attachment-usage/admin/classes/finder/product-category-media-finder.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\SettingsLib\\Elements\\Validators\\Abstract_Validator' not found in wp-content/plugins/attachment-usage/admin/settings_page/elements/validators/number-validator.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\SettingsLib\\Elements\\Basic_Field' not found in wp-content/plugins/attachment-usage/admin/settings_page/elements/fields/textarea.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'AttachmentUsage\\Interfaces\\IConfigure' not found in wp-content/plugins/attachment-usage/admin/classes/meta-box.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\SettingsLib\\Elements\\Validators\\Abstract_Whitelist_Validator' not found in wp-content/plugins/attachment-usage/admin/settings_page/elements/validators/radio-whitelist-validator.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'AttachmentUsage\\SettingsLib\\Elements\\Basic_Element' not found in wp-content/plugins/attachment-usage/admin/settings_page/elements/section.php:5

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 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Tags: Too many tags (17 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

attachment-usage/attachment-usage.php Passed 13 tests

"Attachment Usage" version 1.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
117 characters long description:
Find your attachment/media files used by different locations (posts, pages, widgets, galleries etc.) on your website.

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
Good job! No executable or dangerous file extensions detected4,041 lines of code in 112 files:
LanguageFilesBlank linesComment linesLines of code
PHP1046661593,374
JavaScript55241374
PO File17488226
CSS218467

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity5.31
▷ Minimum class complexity1.00
▷ Maximum class complexity30.00
Average method complexity2.32
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces14
Interfaces4
Traits0
Classes76
▷ Abstract classes67.89%
▷ Concrete classes7092.11%
▷ Final classes00.00%
Methods275
▷ Static methods62.18%
▷ Public methods17463.27%
▷ Protected methods4616.73%
▷ Private methods5520.00%
Functions8
▷ Named functions450.00%
▷ Anonymous functions450.00%
Constants2
▷ Global constants150.00%
▷ Class constants150.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

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