83% stock-update-for-wc

Code Review | Stock Update for WC

WordPress plugin Stock Update for WC scored83%from 54 tests.

About plugin

  • Plugin page: stock-update-for-wc
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.4
  • WordPress version: 6.3.1
  • First release: May 22, 2020
  • Latest release: Jul 19, 2020
  • Number of updates: 4
  • Update frequency: every 15.0 days
  • Top authors: pawansahai (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /411 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
Install script ran successfully

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

An overview of server-side resources used by Stock Update for WC
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0144.52 ▲0.56
Dashboard /wp-admin3.31 ▲0.0157.77 ▲0.82
Posts /wp-admin/edit.php3.37 ▲0.0145.93 ▲0.75
Add New Post /wp-admin/post-new.php5.89 ▲0.0187.43 ▼14.48
Media Library /wp-admin/upload.php3.24 ▲0.0135.93 ▲4.05

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 80 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

Stock Update for WC: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲8014.74 ▲0.161.95 ▼0.2447.35 ▼1.14
Dashboard /wp-admin2,206 ▲184.88 ▼0.23111.38 ▼5.2082.77 ▲34.55
Posts /wp-admin/edit.php2,101 ▲121.99 ▼0.0234.77 ▼0.0333.19 ▼1.50
Add New Post /wp-admin/post-new.php1,536 ▲2222.94 ▲5.42770.78 ▲65.4252.81 ▼0.59
Media Library /wp-admin/upload.php1,406 ▲184.16 ▼0.0597.80 ▼10.8869.15 ▲26.12

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts

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
Good news, no errors were detected

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
Please take a closer look at the following
  • 2× 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/stock-update-for-wc/admin/class.paone_su_admin_model.php:139
    • > PHP Fatal error
      Uncaught Error: Class 'PaoneSuAdminModel' not found in wp-content/plugins/stock-update-for-wc/admin/class.paone_su_admin.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from), #2 (This is the second screen shot)
You can look at the official readme.txt

stock-update-for-wc/paone-stock-update.php 85% from 13 tests

The primary PHP file in "Stock Update for WC" version 1.0.0 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Text Domain: The text domain should only use lowercase characters and dashes
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("stock-update-for-wc.php" instead of "paone-stock-update.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected12,557 lines of code in 75 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript662,90089011,580
CSS4656522
PHP580130455

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity25.00
▷ Minimum class complexity17.00
▷ Maximum class complexity33.00
Average method complexity7.86
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods7
▷ Static methods00.00%
▷ Public methods571.43%
▷ Protected methods228.57%
▷ Private methods00.00%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
3 compressed PNG files occupy 0.00MB
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/delete-icon.png1.27KB1.39KB0.00%
images/icon.png0.71KB0.52KB▼ 26.47%
assets/images/add-icon.png1.48KB1.57KB0.00%