94% smooth-scroll-to-top

Code Review | Smooth-scroll-to-top

WordPress plugin Smooth-scroll-to-top scored 94% from 54 tests.

About plugin

  • Plugin page: smooth-scroll-to-top
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.6.1
  • WordPress version: 5.8.1
  • First release: Oct 19, 2013
  • Latest release: Oct 20, 2013
  • Number of updates: 10
  • Update frequency: every 6.4 days
  • Top authors: Dostogir (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

20+ active / 1,014 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▼0.23MB] [CPU: ▼145.05ms] Passed 4 tests

Server-side resources used by Smooth-scroll-to-top
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /1.77 ▼0.956.45 ▼15.93
Dashboard /wp-admin3.07 ▲0.0151.61 ▲1.31
Posts /wp-admin/edit.php3.12 ▲0.0140.94 ▼0.03
Add New Post /wp-admin/post-new.php5.43 ▼0.0191.68 ▼560.88
Media Library /wp-admin/upload.php3.01 ▲0.0136.41 ▼3.36

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 7 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Smooth-scroll-to-top
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,797 ▲20116.57 ▲0.9921.48 ▲8.1357.57 ▲3.71
Dashboard /wp-admin2,970 ▲335.87 ▼0.07148.39 ▼5.80107.87 ▼9.29
Posts /wp-admin/edit.php2,736 ▼32.73 ▼0.0064.97 ▼12.1993.08 ▲3.27
Add New Post /wp-admin/post-new.php1,683 ▼018.77 ▲0.38416.90 ▼5.43110.46 ▼2.48
Media Library /wp-admin/upload.php1,807 ▼35.03 ▼0.00156.47 ▼8.94120.07 ▲4.53

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Uninstall script ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/smooth-scroll-to-top/scroll-to-top.php:21

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

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
These attributes need your attention:
  • Screenshots: These screenshots do not have images: #1 (Scroll icon & Browser Scroll Style), #2 (Browser Scroll on Chrome)
You can look at the official readme.txt

smooth-scroll-to-top/scroll-to-top.php 92% from 13 tests

This is the main PHP file of "Smooth-scroll-to-top" version 1.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("smooth-scroll-to-top.php" instead of "scroll-to-top.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
Good job! No executable or dangerous file extensions detected80 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP131945
JavaScript16618
CSS17517

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 complexity6.00
▷ Minimum class complexity6.00
▷ Maximum class complexity6.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods5
▷ Static methods00.00%
▷ Public methods240.00%
▷ Protected methods00.00%
▷ Private methods360.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants250.00%
▷ Class constants250.00%
▷ 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
3 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png0.51KB0.22KB▼ 56.35%
images/scroll-img.png0.51KB0.62KB0.00%
screenshot-1.png9.65KB4.27KB▼ 55.70%