84% smart-pwa

Code Review | Smart PWA

WordPress plugin Smart PWA scored84%from 54 tests.

About plugin

  • Plugin page: smart-pwa
  • Plugin version: 0.1.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-4.9.5
  • WordPress version: 6.3.1
  • First release: May 2, 2018
  • Latest release: May 22, 2018
  • Number of updates: 9
  • Update frequency: every 2.2 days
  • Top authors: Toro_Unit (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /1,610 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

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

An overview of server-side resources used by Smart PWA
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0447.67 ▲7.06
Dashboard /wp-admin3.32 ▼0.0246.29 ▼13.20
Posts /wp-admin/edit.php3.37 ▲0.0245.39 ▼1.51
Add New Post /wp-admin/post-new.php5.90 ▲0.0277.27 ▼17.43
Media Library /wp-admin/upload.php3.24 ▲0.0236.08 ▲3.47

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 10 new files
Database: no new tables, 8 new options
New WordPress options
smart_pwa_queue_flush_rules
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
smart_pwa_assets_paths
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Smart PWA
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,807 ▲6114.79 ▲0.121.73 ▼0.1644.32 ▲2.08
Dashboard /wp-admin2,206 ▲155.90 ▲0.00110.32 ▲10.6642.10 ▲0.94
Posts /wp-admin/edit.php2,092 ▼02.00 ▼0.0036.48 ▲0.8131.26 ▼2.05
Add New Post /wp-admin/post-new.php1,519 ▲522.80 ▲5.10661.31 ▼14.7053.31 ▲1.20
Media Library /wp-admin/upload.php1,388 ▼04.28 ▲0.0296.02 ▼14.8742.00 ▼8.33

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 8 options in the database
    • smart_pwa_assets_paths
    • smart_pwa_queue_flush_rules
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Smart_PWA\\register_activation_hook() in wp-content/plugins/smart-pwa/includes/class-app.php:26
    • > PHP Warning
      Use of undefined constant MINUTE_IN_SECONDS - assumed 'MINUTE_IN_SECONDS' (this will throw an Error in a future version of PHP) in wp-content/plugins/smart-pwa/includes/class-app.php on line 13
    • > PHP Warning
      A non-numeric value encountered in wp-content/plugins/smart-pwa/includes/class-app.php on line 13
    • > PHP Warning
      A non-numeric value encountered in wp-content/plugins/smart-pwa/includes/class-app.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_transient() in wp-content/plugins/smart-pwa/includes/js/sw.js.php:10
    • > PHP Warning
      Use of undefined constant MINUTE_IN_SECONDS - assumed 'MINUTE_IN_SECONDS' (this will throw an Error in a future version of PHP) in wp-content/plugins/smart-pwa/includes/class-app.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/smart-pwa/includes/manifest.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
4 plugin tags: manifest, progressive web apps, web manifest, pwa

smart-pwa/smart-pwa.php Passed 13 tests

The main PHP file in "Smart PWA" ver. 0.1.6 adds more information about the plugin and also serves as the entry point for this plugin
17 characters long description:
PWA for WordPress

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin344 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP892179344

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity4.75
▷ Minimum class complexity1.00
▷ Maximum class complexity9.00
Average method complexity1.72
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods19
▷ Static methods631.58%
▷ Public methods19100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions3
▷ Named functions266.67%
▷ Anonymous functions133.33%
Constants6
▷ Global constants116.67%
▷ Class constants583.33%
▷ Public constants5100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.08MB with 0.06MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
wp-logo.png82.46KB25.93KB▼ 68.56%