67% primer-mydata

Code Review | Primer MyData for Woocommerce

WordPress plugin Primer MyData for Woocommerce scored67%from 54 tests.

About plugin

  • Plugin page: primer-mydata
  • Plugin version: 4.1.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.3.2
  • WordPress version: 6.3.1
  • First release: Feb 7, 2022
  • Latest release: Oct 28, 2023
  • Number of updates: 71
  • Update frequency: every 8.9 days
  • Top authors: primersoftware (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

20+ active /3,408 total downloads

Benchmarks

Plugin footprint 82% 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.01MB] [CPU: ▼5.47ms] Passed 4 tests

Analyzing server-side resources used by Primer MyData for Woocommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0033.83 ▼7.07
Dashboard /wp-admin3.31 ▼0.0444.03 ▼8.31
Posts /wp-admin/edit.php3.36 ▲0.0044.78 ▲2.01
Add New Post /wp-admin/post-new.php5.89 ▲0.0091.08 ▼8.49
Media Library /wp-admin/upload.php3.23 ▲0.0035.21 ▲2.25

Server storage [IO: ▲38.37MB] [DB: ▲0.00MB] 67% from 3 tests

A short overview of filesystem and database impact
Please try to fix the following items
  • Filesystem usage must be lower than 25MB (currently using 38.37MB)
Filesystem: 2,329 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

Primer MyData for Woocommerce: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.37 ▼0.151.76 ▲0.0637.71 ▼5.16
Dashboard /wp-admin2,195 ▲155.66 ▲0.0483.14 ▼5.7337.42 ▲0.65
Posts /wp-admin/edit.php2,100 ▼32.00 ▼0.0338.86 ▼5.9535.04 ▼1.01
Add New Post /wp-admin/post-new.php1,526 ▼523.79 ▲0.64676.50 ▲66.5254.03 ▲3.43
Media Library /wp-admin/upload.php1,400 ▼34.25 ▲0.05110.75 ▲11.7246.35 ▲3.75

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
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
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
  • 123× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Ods.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/markbaker/complex/examples/testOperations.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/dompdf/lib/php-css-parser/tests/quickdump.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/samples/Basic/24_Readfilter.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/samples/Basic/28_Iterator.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_line.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_TCPDF.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie.php
    • > /wp-content/plugins/primer-mydata/includes/vendor/markbaker/complex/examples/complexTest.php
  • 4095× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type float in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php on line 351
    • > PHP Notice
      Trying to access array offset on value of type float in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php on line 351
    • > PHP Notice
      Trying to access array offset on value of type int in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php on line 351
    • > PHP Notice
      Trying to access array offset on value of type float in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php on line 351
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php on line 3465
    • > PHP Notice
      Trying to access array offset on value of type float in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Chart/DataSeriesValues.php on line 351
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\Reader\\BaseReader' not found in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php:61
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php on line 3465
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php on line 3465
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/primer-mydata/includes/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php on line 3465

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Screenshots: These screenshots do not have images: #1 (Orders UI), #2 (Receipts UI), #3 (Receipt example), #4 (Automation UI), #5 (Email Template)
You can look at the official readme.txt

primer-mydata/primer.php 85% from 13 tests

The principal PHP file in "Primer MyData for Woocommerce" v. 4.1.0 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("primer-mydata.php" instead of "primer.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
It is important to fix the following items
  • Do not distribute dangerous files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/primer-mydata/includes/vendor/phpqrcode/tools/merge.bat
323,877 lines of code in 1,314 files:
LanguageFilesBlank linesComment linesLines of code
PHP95938,71481,671211,026
XML133240,005
PO File12114,92519,57733,842
Markdown553,406013,478
JavaScript221,9741,2729,486
CSS686381,3316,638
JSON22005,248
SVG3111,638
Sass16300251,379
YAML1811221474
C#10451318
HTML3500260
MSBuild script10757
Bourne Again Shell16324
Bourne Shell1002
DOS Batch1002

PHP code 0% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 1,016)
  • Method cyclomatic complexity should be reduced to less than 100 (currently 651)
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity35.36
▷ Minimum class complexity1.00
▷ Maximum class complexity1,016.00
Average method complexity4.29
▷ Minimum method complexity1.00
▷ Maximum method complexity651.00
Code structure
Namespaces99
Interfaces31
Traits4
Classes779
▷ Abstract classes536.80%
▷ Concrete classes72693.20%
▷ Final classes253.44%
Methods8,690
▷ Static methods1,17313.50%
▷ Public methods6,97380.24%
▷ Protected methods1,02011.74%
▷ Private methods6978.02%
Functions207
▷ Named functions14971.98%
▷ Anonymous functions5828.02%
Constants1,404
▷ Global constants1158.19%
▷ Class constants1,28991.81%
▷ Public constants1,27799.07%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
105 PNG files occupy 1.10MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/vendor/phpqrcode/cache/frame_37.png0.27KB0.25KB▼ 7.89%
includes/vendor/cmb2/images/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
includes/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Exports/ReaderWriter.png45.01KB14.75KB▼ 67.24%
public/css/images/ui-icons_cc0000_256x240.png4.44KB4.17KB▼ 6.02%
includes/vendor/phpqrcode/cache/frame_4.png0.15KB0.14KB▼ 1.34%