79% pwa4wp

Code Review | PWA for WordPress

WordPress plugin PWA for WordPress scored79%from 54 tests.

About plugin

  • Plugin page: pwa4wp
  • Plugin version: 1.2.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-5.1
  • WordPress version: 6.3.1
  • First release: Aug 29, 2018
  • Latest release: Apr 23, 2019
  • Number of updates: 55
  • Update frequency: every 4.3 days
  • Top authors: ryushindo (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

500+ active /7,987 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

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

Analyzing server-side resources used by PWA for WordPress
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.40 ▼0.0729.02 ▼15.66
Dashboard /wp-admin3.35 ▲0.0557.78 ▲7.43
Posts /wp-admin/edit.php3.47 ▲0.1156.77 ▼1.29
Add New Post /wp-admin/post-new.php5.93 ▲0.0491.13 ▼6.65
Media Library /wp-admin/upload.php3.25 ▲0.0240.55 ▲4.68

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 41 new files
Database: no new tables, 10 new options
New WordPress options
db_upgraded
pwa4wp_sw_installation_switch
can_compress_scripts
widget_recent-posts
widget_recent-comments
pwa4wp_sw_version
theysaidso_admin_options
pwa4wp_defer_install
widget_theysaidso_widget
pwa4wp_multisite_unify

Browser metrics Passed 4 tests

Checking browser requirements for PWA for WordPress
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,995 ▲23414.87 ▲0.622.46 ▲0.5543.13 ▲4.43
Dashboard /wp-admin2,397 ▲2206.62 ▲1.05114.56 ▲20.7038.37 ▼2.91
Posts /wp-admin/edit.php2,328 ▲2283.79 ▲1.8057.80 ▲19.2733.89 ▼2.73
Add New Post /wp-admin/post-new.php1,574 ▲4623.50 ▲0.57672.50 ▲8.1937.09 ▼19.64
Media Library /wp-admin/upload.php1,465 ▲654.50 ▲0.2797.69 ▼11.5548.47 ▲1.67
Manifest /wp-admin/admin.php?page=PWA for WordPress?11,5943.5977.3674.33
PWA for WordPress /wp-admin/admin.php?page=PWA for WordPress1,2823.6344.3963.37
ServiceWorker /wp-admin/admin.php?page=PWA for WordPress?21,4993.8246.9927.83

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 10 options in the database
    • can_compress_scripts
    • pwa4wp_multisite_unify
    • widget_recent-posts
    • pwa4wp_sw_installation_switch
    • pwa4wp_sw_version
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • pwa4wp_defer_install

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

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/pwa4wp/public/partials/pwa4wp-public-display.php
  • 21× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function update_option() in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-display.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-sw.php:23
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-manifest.php on line 15
    • > PHP Warning
      Use of undefined constant PWA4WP_MANIFEST_FILE - assumed 'PWA4WP_MANIFEST_FILE' (this will throw an Error in a future version of PHP) in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-display.php on line 17
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-manifest.php on line 17
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-sw.php on line 17
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-sw.php on line 17
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-sw.php on line 16
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-sw.php on line 15
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pwa4wp/admin/partials/pwa4wp-admin-sw.php on line 16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
8 plugin tags: cache, pwa, offline, progressive web apps, mobile...

pwa4wp/pwa4wp.php Passed 13 tests

Analyzing the main PHP file in "PWA for WordPress" version 1.2.0
45 characters long description:
Provides transformation for WordPress to PWA.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin2,495 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
PHP181785571,646
JavaScript52955364
PO File1120158328
CSS238116
Markdown119041

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity9.50
▷ Minimum class complexity1.00
▷ Maximum class complexity56.00
Average method complexity2.39
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes00.00%
Methods43
▷ Static methods24.65%
▷ Public methods3479.07%
▷ Protected methods00.00%
▷ Private methods920.93%
Functions13
▷ Named functions323.08%
▷ Anonymous functions1076.92%
Constants5
▷ Global constants5100.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
5 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/assets/images/green-35.png0.50KB0.31KB▼ 37.99%
public/assets/images/red-35.png0.49KB0.33KB▼ 31.54%
public/img/no_img.png11.48KB5.33KB▼ 53.52%
public/assets/images/green-35.png0.50KB0.31KB▼ 37.99%
admin/assets/images/red-35.png0.49KB0.33KB▼ 31.54%