78% simple-coupon-import

Code Review | Simple Coupon Import

WordPress plugin Simple Coupon Import scored78%from 54 tests.

About plugin

  • Plugin page: simple-coupon-import
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.8.1
  • WordPress version: 6.3.1
  • First release: Oct 2, 2021
  • Latest release: Oct 6, 2021
  • Number of updates: 8
  • Update frequency: every 0.6 days
  • Top authors: tinhnguyenvan (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /609 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 successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.00MB] [CPU: ▼14.46ms] Passed 4 tests

Analyzing server-side resources used by Simple Coupon Import
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.98 ▼6.11
Dashboard /wp-admin3.32 ▼0.0346.77 ▼17.39
Posts /wp-admin/edit.php3.37 ▲0.0148.88 ▼3.34
Add New Post /wp-admin/post-new.php5.90 ▲0.0185.74 ▼28.84
Media Library /wp-admin/upload.php3.24 ▲0.0137.22 ▼5.50
From file csv /wp-admin/admin.php?page=coupon-import3.2534.01
From connect API /wp-admin/admin.php?page=coupon-import-api3.2635.67

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 18 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
db_upgraded
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Simple Coupon Import
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲5514.53 ▲0.181.74 ▼0.3743.64 ▲3.56
Dashboard /wp-admin2,225 ▲485.57 ▲0.0095.81 ▲5.6638.66 ▼7.82
Posts /wp-admin/edit.php2,127 ▲272.01 ▼0.0339.51 ▼0.2234.58 ▼5.84
Add New Post /wp-admin/post-new.php1,548 ▲2223.15 ▲0.12657.46 ▼10.3955.87 ▼1.72
Media Library /wp-admin/upload.php1,424 ▲244.21 ▲0.03101.65 ▼12.1843.77 ▼2.59
From file csv /wp-admin/admin.php?page=coupon-import8732.0324.0433.50
From connect API /wp-admin/admin.php?page=coupon-import-api9702.0023.4529.10

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
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

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
Please fix the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/simple-coupon-import/simple-coupon-import.php
  • 53× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/psr7/src/NoSeekStream.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Cookie\\CookieJarInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/promises/src/Coroutine.php:45
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\TaskQueueInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/promises/src/TaskQueue.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/psr7/src/PumpStream.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/psr7/src/LimitStream.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/simple-coupon-import/vendor/psr/http-message/src/ResponseInterface.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/psr7/src/BufferStream.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/simple-coupon-import/vendor/guzzlehttp/promises/src/RejectedPromise.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that require attention: You can take inspiration from this readme.txt

simple-coupon-import/simple-coupon-import.php 92% from 13 tests

The main file in "Simple Coupon Import" v. 1.0.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin13,654 lines of code in 155 files:
LanguageFilesBlank linesComment linesLines of code
PHP1262,0645,7179,330
Markdown141,16003,497
JSON1200807
make1409
YAML1007
CSS1004

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity12.50
▷ Minimum class complexity1.00
▷ Maximum class complexity88.00
Average method complexity2.75
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces10
Interfaces26
Traits3
Classes83
▷ Abstract classes00.00%
▷ Concrete classes83100.00%
▷ Final classes3440.96%
Methods755
▷ Static methods13918.41%
▷ Public methods64184.90%
▷ Protected methods40.53%
▷ Private methods11014.57%
Functions127
▷ Named functions3829.92%
▷ Anonymous functions8970.08%
Constants64
▷ Global constants11.56%
▷ Class constants6398.44%
▷ Public constants5282.54%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
public/img/icon.png0.54KB0.47KB▼ 13.11%