78% attribution

Code Review | Attribution for WordPress

WordPress plugin Attribution for WordPress scored78%from 54 tests.

About plugin

  • Plugin page: attribution
  • Plugin version: 1.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.5.1
  • WordPress version: 6.3.1
  • First release: Feb 6, 2016
  • Latest release: Oct 20, 2020
  • Number of updates: 16
  • Update frequency: every 107.4 days
  • Top authors: attribution (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,389 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.04MB] [CPU: ▼1.69ms] Passed 4 tests

Analyzing server-side resources used by Attribution for WordPress
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0438.30 ▼6.00
Dashboard /wp-admin3.34 ▲0.0446.19 ▲0.01
Posts /wp-admin/edit.php3.39 ▲0.0449.46 ▲1.61
Add New Post /wp-admin/post-new.php5.92 ▲0.0394.84 ▼2.36
Media Library /wp-admin/upload.php3.26 ▲0.0340.49 ▲5.65
Attribution /wp-admin/options-general.php?page=attribution3.2530.90

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 25 new files
Database: no new tables, 7 new options
New WordPress options
attribution_wordpress_options
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Attribution for WordPress
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,810 ▲6413.28 ▼1.094.94 ▲2.9640.07 ▲1.64
Dashboard /wp-admin2,210 ▲195.83 ▲0.9797.01 ▼8.3838.45 ▼6.54
Posts /wp-admin/edit.php2,096 ▲102.02 ▲0.0338.61 ▲0.7734.54 ▼5.31
Add New Post /wp-admin/post-new.php1,539 ▼323.26 ▲5.09659.04 ▲20.8759.29 ▲9.47
Media Library /wp-admin/upload.php1,392 ▲14.23 ▲0.0499.86 ▼0.7741.44 ▼2.69
Attribution /wp-admin/options-general.php?page=attribution9432.0426.1729.40

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 16× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/attribution/tests/test-attribution-analytics-wordpress.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Attribution_Commerce' not found in wp-content/plugins/attribution/integrations/ecommerce/woocommerce.php:3
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/attribution/tests/bootstrap.php on line 9
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/attribution/tests/test-attribution-settings.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/attribution/tests/test-attribution-analytics.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/attribution/attribution-wordpress.php:1084
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/attribution/tests/bootstrap.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_js() in wp-content/plugins/attribution/templates/track.php:2
    • > PHP Notice
      Undefined variable: ignore in wp-content/plugins/attribution/templates/snippet.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/attribution/templates/settings.php:2

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
These are user-side errors you should fix
    • > GET request to /wp-admin/options-general.php?page=attribution
    • > Javascript (severe) in unknown
    /wp-admin/options-general.php?page=attribution 205:1 Uncaught ReferenceError: Attribution is not defined

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% 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
These attributes need your attention:
  • Contributors: The plugin contributors field is not present
  • Requires php: Invalid plugin version format
You can take inspiration from this readme.txt

attribution/attribution-wordpress.php 92% from 13 tests

The principal PHP file in "Attribution for WordPress" v. 1.0.5 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("attribution.php" instead of "attribution-wordpress.php")

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
Success! There were no dangerous files found in this plugin1,530 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP174797791,373
Bourne Shell115459
Bourne Again Shell1201349
XML10032
Markdown113012
make1575

PHP code Passed 2 tests

An short overview of 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.26
Average class complexity12.30
▷ Minimum class complexity1.00
▷ Maximum class complexity52.00
Average method complexity2.20
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes110.00%
▷ Concrete classes990.00%
▷ Final classes00.00%
Methods100
▷ Static methods2727.00%
▷ Public methods9696.00%
▷ Protected methods00.00%
▷ Private methods44.00%
Functions6
▷ Named functions350.00%
▷ Anonymous functions350.00%
Constants6
▷ Global constants466.67%
▷ Class constants233.33%
▷ Public constants2100.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
1 PNG file occupies 0.27MB with 0.16MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png271.87KB109.27KB▼ 59.81%