62% cost-calculator-cost-estimation

Code Review | Cost Calculator & Cost Estimation

WordPress plugin Cost Calculator & Cost Estimation scored62%from 54 tests.

About plugin

  • Plugin page: cost-calculator-c...
  • Plugin version: 1.8.5
  • PHP compatiblity: 5.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.3
  • WordPress version: 6.3.1
  • First release: Nov 9, 2021
  • Latest release: Aug 28, 2023
  • Number of updates: 27
  • Update frequency: every 24.3 days
  • Top authors: rednumber (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

100+ active /3,176 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.21MB] [CPU: ▼3.87ms] Passed 4 tests

A check of server-side resources used by Cost Calculator & Cost Estimation
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.2135.80 ▼1.92
Dashboard /wp-admin3.53 ▲0.1848.73 ▼10.09
Posts /wp-admin/edit.php3.64 ▲0.2951.22 ▲4.94
Add New Post /wp-admin/post-new.php6.11 ▲0.2379.13 ▼4.98
Media Library /wp-admin/upload.php3.43 ▲0.2034.36 ▲1.51
Entries /wp-admin/edit.php?post_type=cf_submissions3.5140.89
Calculation Forms /wp-admin/edit.php?post_type=calculation_forms3.5037.27
Settings /wp-admin/edit.php?post_type=calculation_forms&page=calculation-forms-settings3.4033.64
Add New /wp-admin/post-new.php?post_type=calculation_forms3.5749.38
Coupons /wp-admin/edit.php?post_type=cf_coupon3.5038.92
Add-ons /wp-admin/edit.php?post_type=calculation_forms&page=calculation-forms-add-ons3.4031.21

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Cost Calculator & Cost Estimation
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,032 ▲28614.97 ▲0.611.68 ▼0.0840.98 ▲0.42
Dashboard /wp-admin2,414 ▲2376.56 ▲0.96109.35 ▲19.8295.05 ▲50.56
Posts /wp-admin/edit.php2,354 ▲2513.74 ▲1.7650.80 ▲9.9162.89 ▲25.13
Add New Post /wp-admin/post-new.php6,271 ▲4,73619.44 ▲1.31851.84 ▲192.5536.92 ▼24.20
Media Library /wp-admin/upload.php1,497 ▲1034.53 ▲0.33114.52 ▲15.8043.24 ▲1.47
Entries /wp-admin/edit.php?post_type=cf_submissions1,3723.6454.3161.11
Calculation Forms /wp-admin/edit.php?post_type=calculation_forms1,3413.6345.8056.45
Settings /wp-admin/edit.php?post_type=calculation_forms&page=calculation-forms-settings1,3693.4040.5360.03
Add New /wp-admin/post-new.php?post_type=calculation_forms4,2004.89120.6582.44
Coupons /wp-admin/edit.php?post_type=cf_coupon1,3303.6448.0178.70
Add-ons /wp-admin/edit.php?post_type=calculation_forms&page=calculation-forms-add-ons1,3693.3940.4466.81

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 48 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=calculation_forms&page=calculation-forms-add-ons
    • > Notice in wp-content/plugins/cost-calculator-cost-estimation/backend/settings.php+53
    Undefined index: currencies

SRP 0% 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
Please fix the following
  • 5× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cost-calculator-cost-estimation/vendor/sabberworm/php-css-parser/tests/quickdump.php
    • > /wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/build.php
    • > /wp-content/plugins/cost-calculator-cost-estimation/rednumber/check_purchase_code.php
    • > /wp-content/plugins/cost-calculator-cost-estimation/calculation-forms.php
    • > /wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/update_certs.php
  • 435× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cost-calculator-cost-estimation/fields/payment_methods.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/lib/Service/SkuService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/lib/Radar/ValueList.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/lib/InvoiceLineItem.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\StripeObject' not found in wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/lib/ApiResource.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/lib/LineItem.php:21
    • > PHP Fatal error
      Uncaught Error: Interface 'Svg\\Surface\\SurfaceInterface' not found in wp-content/plugins/cost-calculator-cost-estimation/vendor/phenx/php-svg-lib/src/Svg/Surface/SurfaceGmagick.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cost-calculator-cost-estimation/backend/block_editor/register_block.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cost-calculator-cost-estimation/fields/recaptcha.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/lib/BitcoinTransaction.php:16

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
9 plugin tags: cost calculator, calculated, payment forms, booking, cost estimation...

cost-calculator-cost-estimation/calculation-forms.php 85% from 13 tests

The main PHP file in "Cost Calculator & Cost Estimation" ver. 1.8.5 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("cost-calculator-cost-estimation.php" instead of "calculation-forms.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
These items require your attention
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/cost-calculator-cost-estimation/vendor/stripe/stripe-php/data/ca-certificates.crt
77,752 lines of code in 672 files:
LanguageFilesBlank linesComment linesLines of code
PHP55311,20826,35968,051
JavaScript161335144,119
Markdown171,06402,488
CSS531791091,966
JSON1100704
XML982196
YAML7202120
SVG332062
make19027
HTML10017
Ruby1002

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Please tend to the following items
  • Method cyclomatic complexity should be reduced to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity16.22
▷ Minimum class complexity1.00
▷ Maximum class complexity807.00
Average method complexity3.47
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces71
Interfaces17
Traits7
Classes481
▷ Abstract classes234.78%
▷ Concrete classes45895.22%
▷ Final classes00.00%
Methods3,121
▷ Static methods2999.58%
▷ Public methods2,72087.15%
▷ Protected methods2568.20%
▷ Private methods1454.65%
Functions187
▷ Named functions6434.22%
▷ Anonymous functions12365.78%
Constants960
▷ Global constants70.73%
▷ Class constants95399.27%
▷ Public constants953100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
6 PNG files occupy 0.05MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
backend/images/fromat-pro.png10.45KB2.89KB▼ 72.32%
modules/signature/lib/images/remove-icon.png2.39KB1.19KB▼ 50.31%
backend/images/eye_off_icon.png1.52KB0.97KB▼ 36.12%
frontend/images/stripe.png14.89KB4.09KB▼ 72.51%
backend/images/upgrade.png24.11KB7.27KB▼ 69.85%