93% back-to-top-button

Code Review | Back to Top Button

WordPress plugin Back to Top Button scored 93% from 54 tests.

About plugin

  • Plugin page: back-to-top-button
  • Plugin version: 1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-4.6
  • WordPress version: 5.8.1
  • First release: Aug 20, 2016
  • Latest release: Oct 6, 2016
  • Number of updates: 24
  • Update frequency: every 6.4 days
  • Top authors: seosbg (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active / 2,265 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.42MB] [CPU: ▼140.70ms] Passed 4 tests

Analyzing server-side resources used by Back to Top Button
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.22 ▲0.5038.50 ▲14.83
Dashboard /wp-admin3.51 ▲0.4549.58 ▼0.12
Posts /wp-admin/edit.php3.58 ▲0.4755.33 ▲8.57
Add New Post /wp-admin/post-new.php5.80 ▲0.3795.41 ▼569.89
Media Library /wp-admin/upload.php3.39 ▲0.3833.01 ▼1.36

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 190 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Back to Top Button
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,020 ▲42418.03 ▲2.4310.88 ▲4.7249.15 ▼4.11
Dashboard /wp-admin3,177 ▲2437.88 ▲1.93164.01 ▲14.76135.30 ▲21.16
Posts /wp-admin/edit.php3,009 ▲2704.25 ▲1.5687.83 ▲2.69120.96 ▲28.47
Add New Post /wp-admin/post-new.php1,703 ▲2018.98 ▲0.30370.84 ▼29.45134.26 ▲17.59
Media Library /wp-admin/upload.php1,778 ▼294.79 ▼0.26124.66 ▼38.75148.92 ▲22.51

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for 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: 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 trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/back-to-top-button/back-to-top.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Tags: There are too many tags (23 tag instead of maximum 10)
Please take inspiration from this readme.txt

back-to-top-button/back-to-top.php 92% from 13 tests

The main PHP file in "Back to Top Button" ver. 1.5 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("back-to-top-button.php" instead of "back-to-top.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin2,128 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP1250251,262
SVG100655
CSS217392
PO File1313281
JavaScript110038

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions21
▷ Named functions21100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
176 PNG files occupy 0.61MB with 0.22MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/83btb.png5.53KB2.67KB▼ 51.69%
images/55btb.png4.51KB2.31KB▼ 48.89%
images/168btb.png3.36KB2.15KB▼ 35.80%
images/146btb.png2.91KB2.03KB▼ 30.33%
images/35btb.png1.91KB1.70KB▼ 11.02%