84% smartcrop

Code Review | SmartCrop

WordPress plugin SmartCrop scored84%from 54 tests.

About plugin

  • Plugin page: smartcrop
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.9
  • WordPress version: 6.3.1
  • First release: Feb 17, 2018
  • Latest release: Feb 19, 2018
  • Number of updates: 6
  • Update frequency: every 1.8 days
  • Top authors: Viper007Bond (100%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active /1,512 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.13MB] [CPU: ▼4.72ms] Passed 4 tests

This is a short check of server-side resources used by SmartCrop
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1440.47 ▲1.27
Dashboard /wp-admin3.47 ▲0.1753.72 ▼0.76
Posts /wp-admin/edit.php3.52 ▲0.1743.76 ▼4.03
Add New Post /wp-admin/post-new.php5.99 ▲0.1084.06 ▼12.70
Media Library /wp-admin/upload.php3.33 ▲0.1035.63 ▼1.40

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

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

Browser metrics Passed 4 tests

SmartCrop: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲2814.24 ▲0.041.91 ▼0.1443.74 ▲0.51
Dashboard /wp-admin2,198 ▲185.60 ▲0.0080.56 ▼19.1939.13 ▼10.10
Posts /wp-admin/edit.php2,100 ▲31.98 ▼0.0234.95 ▼2.1532.48 ▼2.30
Add New Post /wp-admin/post-new.php1,527 ▼123.37 ▲0.15646.62 ▼31.6955.70 ▲1.68
Media Library /wp-admin/upload.php1,403 ▼04.20 ▼0.0494.98 ▼4.1144.63 ▲0.22

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
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts

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
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 12× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-imagick.php on line 9
    • > PHP Warning
      require_once(ABSPATHWPINC/class-wp-image-editor.php): failed to open stream: No such file or directory in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-gd.php on line 9
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-imagick.php on line 9
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHWPINC/class-wp-image-editor.php' (include_path='.:/usr/share/php') in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-imagick.php on line 9
    • > PHP Warning
      Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-gd.php on line 9
    • > PHP Warning
      require_once(ABSPATHWPINC/class-wp-image-editor.php): failed to open stream: No such file or directory in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-imagick.php on line 9
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHWPINC/class-wp-image-editor.php' (include_path='.:/usr/share/php') in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-gd.php on line 9
    • > PHP Warning
      Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-imagick.php on line 9
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-gd.php on line 9
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHWPINC/class-wp-image-editor.php' (include_path='.:/usr/share/php') in wp-content/plugins/smartcrop/includes/class-smartcrop-wp-image-editor-imagick.php on line 9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
3 plugin tags: thumbnails, crop, thumbnail

smartcrop/smartcrop.php Passed 13 tests

The primary PHP file in "SmartCrop" version 1.0.0 is used by WordPress to initiate all plugin functionality
96 characters long description:
Automatically crops image thumbnails based on their contents instead of just centering the crop.

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
No dangerous file extensions were detected429 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP5156398429

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity13.40
▷ Minimum class complexity3.00
▷ Maximum class complexity22.00
Average method complexity3.22
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits2
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods31
▷ Static methods26.45%
▷ Public methods3096.77%
▷ Protected methods00.00%
▷ Private methods13.23%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.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
There were not PNG files found in your plugin