71% afs-analytics-for-woocommerce

Code Review | AFS Analytics for WooCommerce

WordPress plugin AFS Analytics for WooCommerce scored71%from 54 tests.

About plugin

  • Plugin page: afs-analytics-for...
  • Plugin version: 2.18
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 1.4.1-6.3
  • WordPress version: 6.3.1
  • First release: Mar 15, 2018
  • Latest release: Aug 24, 2023
  • Number of updates: 31
  • Update frequency: every 64.2 days
  • Top authors: AddFreeStats (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

10+ active /1,778 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.80MB] [CPU: ▲3.61ms] Passed 4 tests

An overview of server-side resources used by AFS Analytics for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.39 ▲0.9252.09 ▲9.18
Dashboard /wp-admin4.12 ▲0.7761.93 ▼2.44
Posts /wp-admin/edit.php4.16 ▲0.8063.65 ▲13.13
Add New Post /wp-admin/post-new.php6.69 ▲0.8095.98 ▼3.14
Media Library /wp-admin/upload.php4.03 ▲0.8048.12 ▲10.83
AFS Analytics /wp-admin/admin.php?page=afsa_dashboard3.9946.76
Dashboard Demo /wp-admin/admin.php?page=afsa_demo_dashboard_page4.0047.96
AFS Analytics /wp-admin/options-general.php?page=afsa_settings_page3.9946.54
account_manager /wp-admin/admin.php?page=afsa_account_manager4.0045.74
Plugin settings /wp-admin/admin.php?page=afsa_settings_page3.9947.62
Contact us /wp-admin/admin.php?page=afsa_support3.9842.45

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 82 new files
Database: 1 new table, 9 new options
New tables
wp_afsa_processed_order
New WordPress options
theysaidso_admin_options
afsa_accounts
db_upgraded
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
afsa_request_state
afsa_db_schema_version
widget_recent-comments

Browser metrics Passed 4 tests

Checking browser requirements for AFS Analytics for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,912 ▲15114.41 ▼0.241.60 ▼0.3926.19 ▼16.37
Dashboard /wp-admin2,321 ▲1445.74 ▲0.1188.17 ▼9.6979.63 ▲34.34
Posts /wp-admin/edit.php2,137 ▲341.97 ▼0.0438.51 ▲0.4734.53 ▲0.42
Add New Post /wp-admin/post-new.php1,571 ▲2723.30 ▲5.11768.82 ▲95.9653.82 ▼13.03
Media Library /wp-admin/upload.php1,434 ▲344.15 ▼0.04103.20 ▼3.1678.86 ▲31.89
AFS Analytics /wp-admin/admin.php?page=afsa_dashboard8572.0126.1546.42
Dashboard Demo /wp-admin/admin.php?page=afsa_demo_dashboard_page1,6514.2767.29148.47
AFS Analytics /wp-admin/options-general.php?page=afsa_settings_page8982.1724.8530.62
account_manager /wp-admin/admin.php?page=afsa_account_manager8341.9923.3735.64
Plugin settings /wp-admin/admin.php?page=afsa_settings_page9012.2025.8534.01
Contact us /wp-admin/admin.php?page=afsa_support7872.0023.5123.66

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 8 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts
    • afsa_accounts
    • widget_theysaidso_widget
    • can_compress_scripts
    • afsa_request_state

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=afsa_support
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

SRP 50% 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
The following issues need your attention
  • 57× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/upgrade.php' (include_path='.:/usr/share/php') in wp-content/plugins/afs-analytics-for-woocommerce/includes/class-afsa-db.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'AFSA_INCLUDES_DIR/api/oauth/class-afsa-oauth-client.php' (include_path='.:/usr/share/php') in wp-content/plugins/afs-analytics-for-woocommerce/includes/api/class-afsa-api.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'AFSA_INCLUDES_DIR/infos/class-afsa-infos-site.php' (include_path='.:/usr/share/php') in wp-content/plugins/afs-analytics-for-woocommerce/includes/infos/woo/class-afsa-infos-store.php on line 3
    • > PHP Warning
      require_once(AFSA_INCLUDES_DIR/api/oauth/class-afsa-oauth-client.php): failed to open stream: No such file or directory in wp-content/plugins/afs-analytics-for-woocommerce/includes/api/class-afsa-api.php on line 3
    • > PHP Warning
      Use of undefined constant AFSA_INCLUDES_DIR - assumed 'AFSA_INCLUDES_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/afs-analytics-for-woocommerce/includes/controllers/renderer/class-afsa-dashboard-renderer.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'AFSA_INCLUDES_DIR/class-afsa-db.php' (include_path='.:/usr/share/php') in wp-content/plugins/afs-analytics-for-woocommerce/includes/woo/class-afsa-woo-hooks.php on line 4
    • > PHP Warning
      Use of undefined constant AFSA_INCLUDES_DIR - assumed 'AFSA_INCLUDES_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/afs-analytics-for-woocommerce/includes/api/class-afsa-api.php on line 3
    • > PHP Warning
      require_once(AFSA_INCLUDES_DIR/controllers/renderer/class-afsa-dashboard-renderer.php): failed to open stream: No such file or directory in wp-content/plugins/afs-analytics-for-woocommerce/includes/controllers/class-afsa-dashboard-page.php on line 3
    • > PHP Fatal error
      Trait 'AFSA_WOO_Hooks_Utils' not found in wp-content/plugins/afs-analytics-for-woocommerce/includes/woo/class-afsa-woo-hooks-orders.php on line 3
    • > PHP Warning
      require_once(AFSA_INCLUDES_DIR/api/http/class-afsa-http-client.php): failed to open stream: No such file or directory in wp-content/plugins/afs-analytics-for-woocommerce/includes/api/oauth/class-afsa-oauth-client.php on line 8

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following user-side errors
    • > GET request to /wp-admin/admin.php?page=afsa_dashboard
    • > Network (severe)
    wp-content/plugins/afs-analytics-for-woocommerce/assets/images/welcome.png - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (Admin Widget.), #2 (Embedded Dashboard.), #3 (Visitor Profiles / Activity.), #4 (Themes.), #5 (Heatmaps Manager.), #6 (Detailed reports.)
  • Tags: Please delete some tags, you are using 31 tag instead of maximum 10
The official readme.txt is a good inspiration

afs-analytics-for-woocommerce/afs-analytics-woocommerce.php 77% from 13 tests

"AFS Analytics for WooCommerce" version 2.18's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("afs-analytics-for-woocommerce.php" instead of "afs-analytics-woocommerce.php")
  • Requires at least: Required version must match the one declared in readme.txt ("3.5.0" instead of "1.4.1")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected6,336 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
PHP561,6414484,873
CSS717912522
PO File2209243510
JavaScript5804200
SVG111157
Markdown257074

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity11.38
▷ Minimum class complexity1.00
▷ Maximum class complexity90.00
Average method complexity2.16
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits1
Classes54
▷ Abstract classes11.85%
▷ Concrete classes5398.15%
▷ Final classes00.00%
Methods492
▷ Static methods18236.99%
▷ Public methods44790.85%
▷ Protected methods20.41%
▷ Private methods438.74%
Functions11
▷ Named functions00.00%
▷ Anonymous functions11100.00%
Constants39
▷ Global constants3897.44%
▷ Class constants12.56%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
5 PNG files occupy 0.14MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/logo.square.png27.41KB9.83KB▼ 64.15%
assets/images/logo.small.png5.36KB2.67KB▼ 50.15%
assets/images/icon.small.png0.83KB1.20KB0.00%
assets/images/intro.screen.png96.44KB36.36KB▼ 62.29%
assets/images/icon.png17.73KB7.30KB▼ 58.80%