83% discount-for-woocommerce

Code Review | Discount for WooCommerce

WordPress plugin Discount for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: discount-for-wooc...
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.2-5.4.2
  • WordPress version: 6.3.1
  • First release: Jul 20, 2020
  • Latest release: Jul 22, 2020
  • Number of updates: 7
  • Update frequency: every 0.3 days
  • Top authors: BArS (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /439 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▼0.00MB] [CPU: ▼6.08ms] Passed 4 tests

An overview of server-side resources used by Discount for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0146.44 ▲4.96
Dashboard /wp-admin3.31 ▼0.0350.82 ▼15.48
Posts /wp-admin/edit.php3.36 ▲0.0151.64 ▼0.09
Add New Post /wp-admin/post-new.php5.89 ▲0.0186.77 ▼9.72
Media Library /wp-admin/upload.php3.23 ▲0.0135.42 ▲0.96
Discount price /wp-admin/admin.php?page=dpw-sale-submenu-page3.2031.68

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 2 new files
Database: no new tables, 8 new options
New WordPress options
dpw_discount_all
db_upgraded
widget_recent-posts
can_compress_scripts
widget_recent-comments
dpw_discount_logged
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Discount for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲3914.19 ▼0.561.93 ▲0.1443.94 ▼4.48
Dashboard /wp-admin2,195 ▲155.64 ▼0.0593.61 ▲1.0842.02 ▼0.72
Posts /wp-admin/edit.php2,100 ▼02.01 ▼0.0435.13 ▼5.0636.85 ▲2.34
Add New Post /wp-admin/post-new.php1,526 ▼1917.55 ▼5.88671.63 ▼8.8057.07 ▼0.73
Media Library /wp-admin/upload.php1,397 ▼04.25 ▲0.0398.03 ▼3.5543.42 ▲1.58
Discount price /wp-admin/admin.php?page=dpw-sale-submenu-page7892.0524.4925.97

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
The following items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

Smoke tests 75% 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 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 fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/discount-for-woocommerce/index.php:29
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/discount-for-woocommerce/index.php on line 18

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

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
5 plugin tags: price, discount, exchange rate, woocommerce, sale

discount-for-woocommerce/index.php 77% from 13 tests

Analyzing the main PHP file in "Discount for WooCommerce" version 1.0.2
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("discount-for-woocommerce.php" instead of "index.php")
  • Description: The description should be shorter than 140 characters (currently 164 characters long)
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.6" instead of "5.4.2")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected84 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1672384

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
There were not PNG files found in your plugin