68% cannaffiliate-advertiser-setup

Code Review | CannAffiliate Advertiser Setup

WordPress plugin CannAffiliate Advertiser Setup scored68%from 54 tests.

About plugin

  • Plugin page: cannaffiliate-adv...
  • Plugin version: 1.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.0
  • WordPress version: 6.3.1
  • First release: Nov 16, 2020
  • Latest release: Jun 24, 2022
  • Number of updates: 11
  • Update frequency: every 53.5 days
  • Top authors: cannaffiliate (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /387 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.09MB] [CPU: ▼3.27ms] Passed 4 tests

An overview of server-side resources used by CannAffiliate Advertiser Setup
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.0941.95 ▼6.12
Dashboard /wp-admin3.40 ▲0.0946.92 ▲0.10
Posts /wp-admin/edit.php3.51 ▲0.1546.13 ▼1.87
Add New Post /wp-admin/post-new.php6.00 ▲0.1186.71 ▼3.03
Media Library /wp-admin/upload.php3.32 ▲0.0933.24 ▼2.07
CannAffiliate Setup /wp-admin/tools.php?page=cannaffiliate-settings3.2931.59

Server storage [IO: ▲0.05MB] [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: 23 new files
Database: 1 new table, 7 new options
New tables
wp_cannaffiliate_transactions
New WordPress options
db_upgraded
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
plugin_name_db_version
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

CannAffiliate Advertiser Setup: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,891 ▲14513.54 ▼0.835.32 ▲2.8442.21 ▼2.01
Dashboard /wp-admin2,214 ▲264.84 ▼0.19104.75 ▲2.4639.99 ▼7.48
Posts /wp-admin/edit.php2,097 ▲82.00 ▲0.0138.05 ▲2.3936.70 ▲1.62
Add New Post /wp-admin/post-new.php1,521 ▼1223.07 ▼0.13691.21 ▲20.6953.78 ▼5.32
Media Library /wp-admin/upload.php1,396 ▲54.24 ▲0.1196.78 ▼7.2940.74 ▼1.82
CannAffiliate Setup /wp-admin/tools.php?page=cannaffiliate-settings8212.0525.3830.17

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie tables detected upon uninstall: 1 table
    • wp_cannaffiliate_transactions
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • plugin_name_db_version

Smoke tests 50% 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 0% 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
Please take a closer look at the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/cannaffiliate-advertiser-setup/public/partials/cannaffiliate-public-display.php
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cannaffiliate-advertiser-setup/admin/partials/cannaffiliate-admin-settings-display.php:20

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
1 plugin tags: cannaffiliate

cannaffiliate-advertiser-setup/cannaffiliate.php 85% from 13 tests

"CannAffiliate Advertiser Setup" version 1.2'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: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("cannaffiliate-advertiser-setup.php" instead of "cannaffiliate.php")
  • 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 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin427 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP12157549407
CSS22814
JavaScript23546

PHP code Passed 2 tests

A brief analysis 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.23
Average class complexity5.71
▷ Minimum class complexity1.00
▷ Maximum class complexity31.00
Average method complexity2.03
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods32
▷ Static methods26.25%
▷ Public methods2784.38%
▷ Protected methods00.00%
▷ Private methods515.62%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/img/logo-icon.png3.00KB1.58KB▼ 47.30%
admin/img/CannAffiliate-Logo.png7.52KB3.06KB▼ 59.27%