73% discount-rules-by-napps

Code Review | Discount rules by NAPPS

WordPress plugin Discount rules by NAPPS scored73%from 54 tests.

About plugin

  • Plugin page: discount-rules-by...
  • Plugin version: 1.0.7
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Nov 18, 2022
  • Latest release: Nov 13, 2023
  • Number of updates: 13
  • Update frequency: every 27.7 days
  • Top authors: nappssolutions (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /627 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.19MB] [CPU: ▼2.48ms] Passed 4 tests

A check of server-side resources used by Discount rules by NAPPS
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1640.27 ▲0.30
Dashboard /wp-admin3.53 ▲0.2245.67 ▼4.67
Posts /wp-admin/edit.php3.58 ▲0.2248.52 ▲1.48
Add New Post /wp-admin/post-new.php6.30 ▲0.4183.65 ▼7.03
Media Library /wp-admin/upload.php3.39 ▲0.1637.84 ▲2.64

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 46 new files
Database: 3 new tables, 8 new options
New tables
wp_napps_discount_rules_collections
wp_napps_discount_rules
wp_napps_discount_rules_products
New WordPress options
db_upgraded
widget_recent-comments
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
napps_discountrules_version
napps_discountrules_installed
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Discount rules by NAPPS
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.25 ▲0.041.80 ▲0.1242.52 ▼0.83
Dashboard /wp-admin2,198 ▲275.55 ▲0.0185.05 ▼21.4941.27 ▼0.50
Posts /wp-admin/edit.php2,100 ▼31.95 ▼0.0139.00 ▲1.9935.80 ▼0.58
Add New Post /wp-admin/post-new.php1,526 ▼023.54 ▲0.71686.86 ▼51.3754.80 ▼1.30
Media Library /wp-admin/upload.php1,394 ▼34.13 ▼0.1098.63 ▼6.9245.03 ▲0.77

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 50% 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
  • This plugin does not fully uninstall, leaving 3 tables in the database
    • wp_napps_discount_rules_collections
    • wp_napps_discount_rules
    • wp_napps_discount_rules_products
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • napps_discountrules_installed
    • theysaidso_admin_options
    • can_compress_scripts
    • napps_discountrules_version
    • 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 everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'App\\Repository\\WoocommerceRepository' not found in wp-content/plugins/discount-rules-by-napps/app/Repository/ProductRepository.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/discount-rules-by-napps/app/Api/CategoryController.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/discount-rules-by-napps/app/Api/ProductController.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'App\\Repository\\WoocommerceRepository' not found in wp-content/plugins/discount-rules-by-napps/app/Repository/CategoryRepository.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/discount-rules-by-napps/app/Api.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/discount-rules-by-napps/app/Api/DiscountRulesController.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention: The official readme.txt is a good inspiration

discount-rules-by-napps/plugin.php 92% from 13 tests

The main PHP file in "Discount rules by NAPPS" ver. 1.0.7 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("discount-rules-by-napps.php" instead of "plugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin2,344 lines of code in 37 files:
LanguageFilesBlank linesComment linesLines of code
PHP315981,1592,333
JSON1005
CSS2223
JavaScript3013

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity11.58
▷ Minimum class complexity1.00
▷ Maximum class complexity48.00
Average method complexity2.66
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces9
Interfaces0
Traits0
Classes24
▷ Abstract classes14.17%
▷ Concrete classes2395.83%
▷ Final classes14.35%
Methods156
▷ Static methods2214.10%
▷ Public methods13989.10%
▷ Protected methods63.85%
▷ Private methods117.05%
Functions4
▷ Named functions00.00%
▷ Anonymous functions4100.00%
Constants16
▷ Global constants850.00%
▷ Class constants850.00%
▷ Public constants8100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
(invalid) assets/js/b219f8481319273ae941.png13.52KB0.00KB▼ 100.00%
(invalid) assets/js/a4bf06611a4724123de0.png0.42KB0.00KB▼ 100.00%