76% digital-warranty-card-generator

Code Review | Digital Warranty Card Generator

WordPress plugin Digital Warranty Card Generator scored76%from 54 tests.

About plugin

  • Plugin page: digital-warranty-...
  • Plugin version: 1.2
  • PHP compatiblity: 7.4 or higher+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2 or higher-6.4.1
  • WordPress version: 6.3.1
  • First release: Nov 3, 2021
  • Latest release: Nov 17, 2023
  • Number of updates: 9
  • Update frequency: every 82.8 days
  • Top authors: coder426 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

60+ active /1,481 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 gracefully, with no errors

Server metrics [RAM: ▲0.05MB] [CPU: ▼2.03ms] Passed 4 tests

This is a short check of server-side resources used by Digital Warranty Card Generator
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0637.95 ▼2.57
Dashboard /wp-admin3.36 ▲0.0542.67 ▼4.88
Posts /wp-admin/edit.php3.41 ▲0.0544.93 ▼2.65
Add New Post /wp-admin/post-new.php5.94 ▲0.0588.72 ▲3.61
Media Library /wp-admin/upload.php3.28 ▲0.0533.04 ▲2.00

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Digital Warranty Card Generator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,802 ▲4014.67 ▲0.271.84 ▲0.1246.21 ▲1.26
Dashboard /wp-admin2,210 ▲365.58 ▲0.0093.87 ▼17.2442.63 ▼2.38
Posts /wp-admin/edit.php2,112 ▲91.97 ▼0.1240.13 ▲0.9638.21 ▲0.15
Add New Post /wp-admin/post-new.php1,545 ▲1918.21 ▼5.01623.83 ▼78.1472.59 ▲13.00
Media Library /wp-admin/upload.php1,412 ▲124.24 ▲0.0799.62 ▼11.0240.03 ▼9.15

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

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

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
  • 9× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/designP3.php
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/designP1.php
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/pdf_gen.php
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/designL3.php
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/designP2.php
    • > /wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/designL1.php
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/tools/tcpdf_addfont.php
    • > /wp-content/plugins/digital-warranty-card-generator/tcpdf/designL2.php
  • 14× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/digital-warranty-card-generator/include/functions.php:6
    • > PHP Warning
      Use of undefined constant WCGEN_IMG - assumed 'WCGEN_IMG' (this will throw an Error in a future version of PHP) in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php on line 45
    • > PHP Warning
      Use of undefined constant WCGEN_IMG - assumed 'WCGEN_IMG' (this will throw an Error in a future version of PHP) in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php on line 48
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-setting.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php:93
    • > PHP Warning
      Use of undefined constant WCGEN_IMG - assumed 'WCGEN_IMG' (this will throw an Error in a future version of PHP) in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php on line 26
    • > PHP Warning
      Use of undefined constant WCGEN_IMG - assumed 'WCGEN_IMG' (this will throw an Error in a future version of PHP) in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php on line 70
    • > PHP Warning
      Use of undefined constant WCGEN_IMG - assumed 'WCGEN_IMG' (this will throw an Error in a future version of PHP) in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php on line 64
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-left-sidebar.php:6
    • > PHP Warning
      Use of undefined constant WCGEN_IMG - assumed 'WCGEN_IMG' (this will throw an Error in a future version of PHP) in wp-content/plugins/digital-warranty-card-generator/include/admin/wc-admin-right-sidebar.php on line 32

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 80% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Please fix the following attributes:
  • Requires at least: Version not formatted correctly
You can look at the official readme.txt

digital-warranty-card-generator/wc-generator.php 62% from 13 tests

The primary PHP file in "Digital Warranty Card Generator" version 1.2 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("digital-warranty-card-generator.php" instead of "wc-generator.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 427 characters long)
  • Requires at least: Required version number should use periods and dots only (ex. "7.0" instead of "6.2 or higher")
  • Requires PHP: Required version number should use periods and dots only (ex. "7.0" instead of "7.4 or higher")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected50,504 lines of code in 125 files:
LanguageFilesBlank linesComment linesLines of code
PHP1071,61711,86748,997
PO File9264346631
JavaScript575287475
CSS42446401

PHP code 0% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
The following items need your attention
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 4,391)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 502)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity461.71
▷ Minimum class complexity1.00
▷ Maximum class complexity4,391.00
Average method complexity10.14
▷ Minimum method complexity1.00
▷ Maximum method complexity502.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes14
▷ Abstract classes00.00%
▷ Concrete classes14100.00%
▷ Final classes00.00%
Methods706
▷ Static methods11015.58%
▷ Public methods42860.62%
▷ Protected methods27839.38%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants117
▷ Global constants117100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
12 PNG files occupy 0.45MB with 0.27MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/designP3.png53.83KB18.11KB▼ 66.36%
assets/images/kinsta8.png11.32KB5.59KB▼ 50.63%
assets/images/designP2.png54.56KB17.84KB▼ 67.30%
assets/images/design3.png83.19KB27.02KB▼ 67.52%
assets/images/kinsta4.png3.91KB1.87KB▼ 52.26%