84% ga-top-posts

Code Review | Top Posts for Google Analytics by Asentechllc

WordPress plugin Top Posts for Google Analytics by Asentechllc scored84%from 54 tests.

About plugin

  • Plugin page: ga-top-posts
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.2
  • WordPress version: 6.3.1
  • First release: Jul 29, 2019
  • Latest release: Sep 5, 2019
  • Number of updates: 7
  • Update frequency: every 5.9 days
  • Top authors: asentech (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /511 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
Install script ran successfully

Server metrics [RAM: ▲0.14MB] [CPU: ▼7.23ms] Passed 4 tests

Analyzing server-side resources used by Top Posts for Google Analytics by Asentechllc
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1439.10 ▲0.79
Dashboard /wp-admin3.44 ▲0.1444.97 ▼2.90
Posts /wp-admin/edit.php3.56 ▲0.2046.71 ▼0.21
Add New Post /wp-admin/post-new.php6.03 ▲0.1586.27 ▼26.17
Media Library /wp-admin/upload.php3.36 ▲0.1335.39 ▲0.38
GA Top Posts /wp-admin/options-general.php?page=ga-top-posts3.3330.58

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 8 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
widget_gatopposts_widget
db_upgraded
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Top Posts for Google Analytics by Asentechllc
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,811 ▲6513.23 ▼1.121.88 ▲0.1041.45 ▼5.33
Dashboard /wp-admin2,220 ▲354.88 ▼0.9996.57 ▼6.2339.79 ▲3.58
Posts /wp-admin/edit.php2,100 ▲82.16 ▲0.1039.54 ▼6.5836.08 ▲0.48
Add New Post /wp-admin/post-new.php1,524 ▼323.10 ▲4.93651.33 ▲14.7252.53 ▼2.71
Media Library /wp-admin/upload.php1,399 ▲114.27 ▼0.0596.58 ▼8.1443.77 ▼0.51
GA Top Posts /wp-admin/options-general.php?page=ga-top-posts8872.2126.3933.44

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • widget_gatopposts_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
The following issues need your attention
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ga-top-posts/ga-top-posts-widget.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ga-top-posts/ga-top-posts-widget.php:6

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Requires php: Invalid version format
Please take inspiration from this readme.txt

ga-top-posts/ga-top-posts.php 92% from 13 tests

This is the main PHP file of "Top Posts for Google Analytics by Asentechllc" version 1.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Description: The description should be shorter than 140 characters (currently 238 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin1,135 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP3593281,036
JavaScript110367
CSS10032

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity27.57
▷ Minimum class complexity4.00
▷ Maximum class complexity65.00
Average method complexity4.54
▷ Minimum method complexity1.00
▷ Maximum method complexity31.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods51
▷ Static methods11.96%
▷ Public methods4486.27%
▷ Protected methods35.88%
▷ Private methods47.84%
Functions3
▷ Named functions266.67%
▷ Anonymous functions133.33%
Constants20
▷ Global constants00.00%
▷ Class constants20100.00%
▷ Public constants20100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.06MB with 0.04MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png24.72KB7.37KB▼ 70.18%
screenshot-2.png41.28KB18.55KB▼ 55.08%