83% file-un-attach

Code Review | File Un-Attach

WordPress plugin File Un-Attach scored83%from 54 tests.

About plugin

  • Plugin page: file-un-attach
  • Plugin version: 1.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1.0-4.2.4
  • WordPress version: 6.3.1
  • First release: Jun 28, 2011
  • Latest release: Aug 13, 2015
  • Number of updates: 52
  • Update frequency: every 29.2 days
  • Top authors: Hax (100%)

Code review

54 tests

User reviews

12 reviews

Install metrics

700+ active /31,717 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
Installer ran successfully

Server metrics [RAM: ▲0.15MB] [CPU: ▼11.51ms] Passed 4 tests

An overview of server-side resources used by File Un-Attach
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0534.32 ▼10.89
Dashboard /wp-admin3.45 ▲0.1142.49 ▼18.53
Posts /wp-admin/edit.php3.55 ▲0.1948.40 ▲4.51
Add New Post /wp-admin/post-new.php6.23 ▲0.3474.78 ▼13.65
Media Library /wp-admin/upload.php3.47 ▲0.2432.47 ▼2.97

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for File Un-Attach
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,830 ▲8413.26 ▼1.101.90 ▼0.2842.20 ▼8.89
Dashboard /wp-admin2,211 ▲235.01 ▼0.8896.24 ▼17.2239.57 ▼5.21
Posts /wp-admin/edit.php2,091 ▲52.08 ▲0.1036.24 ▲1.9530.46 ▼5.52
Add New Post /wp-admin/post-new.php1,532 ▲1823.37 ▼0.18653.56 ▼46.8357.09 ▲1.14
Media Library /wp-admin/upload.php1,470 ▲824.37 ▲0.20101.42 ▼18.1442.55 ▼5.66

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
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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 trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/file-un-attach/inc/admin.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/file-un-attach/inc/front.php:20

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

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Tags: Too many tags (17 tag instead of maximum 10); only the first 5 tags are used in your directory listing
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Screenshot Media menu), #2 (Screenshot File detach), #3 (Screenshot File attach)
You can take inspiration from this readme.txt

file-un-attach/file-unattach.php 85% from 13 tests

The primary PHP file in "File Un-Attach" version 1.1.3 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.0.0" instead of "3.1.0")
  • Main file name: Name the main plugin file the same as the plugin slug ("file-un-attach.php" instead of "file-unattach.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Success! There were no dangerous files found in this plugin2,760 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP84343252,759
JavaScript11111

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity28.33
▷ Minimum class complexity9.00
▷ Maximum class complexity63.00
Average method complexity5.32
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods19100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions10
▷ Named functions10100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.15MB with 0.08MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png47.84KB19.35KB▼ 59.55%
screenshot-2.png47.89KB21.64KB▼ 54.82%
screenshot-3.png57.19KB25.55KB▼ 55.33%