78% pwacommerce

Code Review | PWACommerce - WooCommerce Mobile Plugin for Progressive Web Apps & Hybrid Mobile Apps

WordPress plugin PWACommerce - WooCommerce Mobile Plugin for Progressive Web Apps & Hybrid Mobile Apps scored78%from 54 tests.

About plugin

  • Plugin page: pwacommerce
  • Plugin version: 0.5.1
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8-5.3.2
  • WordPress version: 6.3.1
  • First release: Nov 20, 2017
  • Latest release: Feb 6, 2020
  • Number of updates: 8
  • Update frequency: every 101.1 days
  • Top authors: abarbulescu (87.5%)mikewire_rocksolid (25%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /7,461 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.18MB] [CPU: ▼0.87ms] Passed 4 tests

This is a short check of server-side resources used by PWACommerce - WooCommerce Mobile Plugin for Progressive Web Apps & Hybrid Mobile Apps
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1439.77 ▲1.07
Dashboard /wp-admin3.49 ▲0.1950.10 ▲1.13
Posts /wp-admin/edit.php3.60 ▲0.2549.18 ▲4.13
Add New Post /wp-admin/post-new.php6.09 ▲0.2084.31 ▼9.82
Media Library /wp-admin/upload.php3.41 ▲0.1838.40 ▲5.45

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 107 new files
Database: no new tables, 12 new options
New WordPress options
pwacommerce_icon
widget_recent-comments
pwacommerce_consumer_secret
theysaidso_admin_options
pwacommerce_service_worker_installed
db_upgraded
can_compress_scripts
pwacommerce_consumer_key
widget_recent-posts
pwacommerce_joined_subscriber_list
...

Browser metrics Passed 4 tests

A check of browser resources used by PWACommerce - WooCommerce Mobile Plugin for Progressive Web Apps & Hybrid Mobile Apps
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,845 ▲9914.66 ▲0.481.70 ▲0.1344.00 ▲3.81
Dashboard /wp-admin2,236 ▲655.81 ▲0.1584.40 ▼7.0589.63 ▲47.85
Posts /wp-admin/edit.php2,159 ▲592.22 ▲0.2332.30 ▼7.2033.57 ▲0.50
Add New Post /wp-admin/post-new.php1,732 ▲20322.32 ▼0.63664.59 ▲1.3429.89 ▼26.69
Media Library /wp-admin/upload.php1,456 ▲534.26 ▲0.02106.09 ▲5.3780.87 ▲31.11

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/pwacommerce/vendor/mobiledetect/mobiledetectlib/export/exportToJSON.php
    • > /wp-content/plugins/pwacommerce/vendor/automattic/woocommerce/tests/bootstrap.php
  • 19× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/pwacommerce/vendor/automattic/woocommerce/tests/WooCommerce/Tests/HttpClient/OAuthTest.php:7
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/pwacommerce/pwacommerce.php on line 19
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/pwacommerce/vendor/automattic/woocommerce/tests/WooCommerce/Tests/HttpClient/BasicAuthTest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/pwacommerce/vendor/automattic/woocommerce/tests/WooCommerce/Tests/HttpClient/OptionsTest.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PWAcommerce\\Includes\\Options' not found in wp-content/plugins/pwacommerce/admin/pages/settings.php:2
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/pwacommerce/pwacommerce.php on line 19
    • > PHP Fatal error
      Uncaught Error: Class 'PWAcommerce\\Frontend\\Frontend_Init' not found in wp-content/plugins/pwacommerce/frontend/themes/app/template.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function PWAcommerce\\Includes\\wp_upload_dir() in wp-content/plugins/pwacommerce/includes/class-uploads.php:37
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/pwacommerce/vendor/automattic/woocommerce/tests/WooCommerce/Tests/ClientTest.php:7
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/pwacommerce/pwacommerce.php on line 19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% 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:
  • Tags: Please reduce the number of tags, currently 33 tag instead of maximum 10
The official readme.txt is a good inspiration

pwacommerce/pwacommerce.php Passed 13 tests

The principal PHP file in "PWACommerce - WooCommerce Mobile Plugin for Progressive Web Apps & Hybrid Mobile Apps" v. 0.5.1 is loaded by WordPress automatically on each request
82 characters long description:
WooCommerce mobile plugin to package your online store into a Progressive Web App.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected6,554 lines of code in 93 files:
LanguageFilesBlank linesComment linesLines of code
PHP441,0021,8432,945
JavaScript214276702,421
Sass8383462
Markdown61660406
JSON500186
XML44678110
YAML26019
CSS32205

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity13.79
▷ Minimum class complexity1.00
▷ Maximum class complexity134.00
Average method complexity2.87
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces10
Interfaces0
Traits0
Classes29
▷ Abstract classes00.00%
▷ Concrete classes29100.00%
▷ Final classes00.00%
Methods200
▷ Static methods126.00%
▷ Public methods17085.00%
▷ Protected methods2814.00%
▷ Private methods21.00%
Functions6
▷ Named functions466.67%
▷ Anonymous functions233.33%
Constants23
▷ Global constants834.78%
▷ Class constants1565.22%
▷ Public constants15100.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 PNG files occupy 0.07MB with 0.05MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/default-theme.png45.87KB14.60KB▼ 68.17%
admin/images/pwacommerce.png17.61KB0.53KB▼ 96.98%
admin/images/btn_close_msg.png3.09KB0.43KB▼ 86.13%