77% bw-coupon

Code Review | BW Coupon

WordPress plugin BW Coupon scored77%from 54 tests.

About plugin

  • Plugin page: bw-coupon
  • Plugin version: 1.4.2
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.2+
  • WordPress version: 6.3.1
  • First release: Mar 22, 2020
  • Latest release: Oct 16, 2023
  • Number of updates: 40
  • Update frequency: every 32.6 days
  • Top authors: veto (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /905 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.01MB] [CPU: ▼5.35ms] Passed 4 tests

Server-side resources used by BW Coupon
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0043.96 ▲4.17
Dashboard /wp-admin3.31 ▼0.0445.35 ▼16.06
Posts /wp-admin/edit.php3.36 ▲0.0046.28 ▼2.28
Add New Post /wp-admin/post-new.php5.89 ▲0.0094.65 ▼1.58
Media Library /wp-admin/upload.php3.23 ▲0.0036.53 ▼1.47

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 346 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by BW Coupon
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲5314.17 ▼0.381.73 ▼0.0140.35 ▼0.96
Dashboard /wp-admin2,192 ▲185.55 ▼0.1385.11 ▼6.3136.57 ▼8.46
Posts /wp-admin/edit.php2,100 ▼02.04 ▲0.0538.48 ▲3.7534.59 ▼2.50
Add New Post /wp-admin/post-new.php1,526 ▼023.32 ▲0.29582.05 ▼86.1359.16 ▼3.42
Media Library /wp-admin/upload.php1,400 ▼34.21 ▼0.1599.63 ▼7.3144.39 ▼3.13

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

SRP 0% 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
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/bw-coupon/lib/dompdf/vendor/masterminds/html5/bin/entities.php
  • 133× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\CSSList\\CSSBlockList' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/sabberworm/php-css-parser/src/CSSList/AtRuleBlockList.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Value\\CSSFunction' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/sabberworm/php-css-parser/src/Value/Color.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Tag\\AbstractTag' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/phenx/php-svg-lib/src/Svg/Document.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Positioner\\AbstractPositioner' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/dompdf/dompdf/src/Positioner/TableCell.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Table\\Table' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/phenx/php-font-lib/src/FontLib/Table/Type/name.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Sabberworm\\CSS\\Renderable' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/sabberworm/php-css-parser/src/Value/Value.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\CSSList\\CSSBlockList' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/sabberworm/php-css-parser/src/CSSList/Document.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Renderer\\Block' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/dompdf/dompdf/src/Renderer/TableCell.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\BinaryStream' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/phenx/php-font-lib/src/FontLib/Table/Table.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\Table\\Table' not found in wp-content/plugins/bw-coupon/lib/dompdf/vendor/phenx/php-font-lib/src/FontLib/Table/Type/hmtx.php:17

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Contributors: Plugin contributors not specified
You can look at the official readme.txt

bw-coupon/bwc.php 85% from 13 tests

The main file in "BW Coupon" v. 1.4.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("bw-coupon.php" instead of "bwc.php")
  • Description: The description should be shorter than 140 characters (currently 236 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected45,776 lines of code in 251 files:
LanguageFilesBlank linesComment linesLines of code
PHP2138,85917,02041,389
JSON11001,758
Markdown1245101,415
CSS212737597
PO File3147156357
JavaScript2496189
YAML19035
HTML10017
Bourne Shell52011
SVG1008

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity32.47
▷ Minimum class complexity1.00
▷ Maximum class complexity811.00
Average method complexity3.97
▷ Minimum method complexity1.00
▷ Maximum method complexity98.00
Code structure
Namespaces37
Interfaces9
Traits0
Classes189
▷ Abstract classes126.35%
▷ Concrete classes17793.65%
▷ Final classes00.00%
Methods2,179
▷ Static methods1426.52%
▷ Public methods1,71678.75%
▷ Protected methods40518.59%
▷ Private methods582.66%
Functions90
▷ Named functions6370.00%
▷ Anonymous functions2730.00%
Constants220
▷ Global constants62.73%
▷ Class constants21497.27%
▷ Public constants20997.66%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
17 PNG files occupy 3.33MB with 1.46MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/banner-600x256.png270.12KB94.71KB▼ 64.94%
admin/images/woocommerce_gift_coupon-icon.png0.37KB0.48KB0.00%
lib/dompdf/vendor/dompdf/dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%
assets/icon-256x256.png100.29KB38.83KB▼ 61.29%
docs/BWC_Settings-1.png158.08KB47.42KB▼ 70.00%