84% product-cost-price

Code Review | Product Cost Price

WordPress plugin Product Cost Price scored84%from 54 tests.

About plugin

  • Plugin page: product-cost-price
  • Plugin version: 1.1.0
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.3.3
  • WordPress version: 6.3.1
  • First release: Jun 26, 2019
  • Latest release: May 5, 2020
  • Number of updates: 5
  • Update frequency: every 62.8 days
  • Top authors: acespritech (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /817 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.00MB] [CPU: ▼3.48ms] Passed 4 tests

Server-side resources used by Product Cost Price
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.29 ▼1.11
Dashboard /wp-admin3.31 ▲0.0050.85 ▲2.26
Posts /wp-admin/edit.php3.36 ▲0.0047.09 ▼4.62
Add New Post /wp-admin/post-new.php5.89 ▲0.0082.71 ▼10.46
Media Library /wp-admin/upload.php3.23 ▲0.0038.51 ▲5.91

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Product Cost Price
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲6514.48 ▼0.071.79 ▼0.0244.05 ▲2.95
Dashboard /wp-admin2,206 ▲154.84 ▼1.06104.55 ▲3.6943.44 ▲1.91
Posts /wp-admin/edit.php2,089 ▼02.00 ▼0.0433.53 ▼3.7333.15 ▼0.85
Add New Post /wp-admin/post-new.php1,514 ▼017.71 ▲0.16666.75 ▼34.9162.37 ▲2.52
Media Library /wp-admin/upload.php1,382 ▼64.27 ▲0.0799.18 ▼1.2643.99 ▲0.57

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, 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
The smoke test was a success, however most plugin functionality was not tested

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
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/product-cost-price/functions/add-profit-tab.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_plugin_active() in wp-content/plugins/product-cost-price/product_cost_price.php:11
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/product-cost-price/product_cost_price.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-cost-price/functions/product-page-options.php:30
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/product-cost-price/product_cost_price.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-cost-price/functions/order-options.php:5
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/product-cost-price/product_cost_price.php on line 10

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: price, cost, profit, report, product

product-cost-price/product_cost_price.php 85% from 13 tests

The entry point to "Product Cost Price" version 1.1.0 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("product-cost-price.php" instead of "product_cost_price.php")
  • Domain Path: The domain path folder was not found ("/languages/")

Code Analysis Passed 3 tests

File types Passed 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
Everything looks great! No dangerous files found in this plugin1,718 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP103993111,715
CSS1003

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity12.50
▷ Minimum class complexity2.00
▷ Maximum class complexity24.00
Average method complexity2.44
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes6
▷ Abstract classes116.67%
▷ Concrete classes583.33%
▷ Final classes00.00%
Methods48
▷ Static methods00.00%
▷ Public methods3981.25%
▷ Protected methods918.75%
▷ Private methods00.00%
Functions16
▷ Named functions16100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
There are no PNG files in this plugin