78% surly

Code Review | Sur.ly

WordPress plugin Sur.ly scored78%from 54 tests.

About plugin

  • Plugin page: surly
  • Plugin version: 3.0.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-5.5.3
  • WordPress version: 6.3.1
  • First release: Jan 10, 2013
  • Latest release: Nov 27, 2020
  • Number of updates: 58
  • Update frequency: every 49.6 days
  • Top authors: surdotly (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

100+ active /7,536 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.17MB] [CPU: ▼9.10ms] Passed 4 tests

Server-side resources used by Sur.ly
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.69 ▲0.1941.90 ▲1.13
Dashboard /wp-admin3.53 ▲0.1449.51 ▼16.55
Posts /wp-admin/edit.php3.64 ▲0.2452.24 ▲0.54
Add New Post /wp-admin/post-new.php6.11 ▲0.1890.96 ▼21.51
Media Library /wp-admin/upload.php3.45 ▲0.1842.12 ▲4.39

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

Browser metrics Passed 4 tests

A check of browser resources used by Sur.ly
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,798 ▲5214.26 ▼0.141.79 ▲0.1439.67 ▼4.40
Dashboard /wp-admin2,204 ▲265.63 ▼0.0286.61 ▼9.2239.30 ▼4.45
Posts /wp-admin/edit.php2,109 ▲92.02 ▼0.0339.20 ▼1.0135.14 ▼4.02
Add New Post /wp-admin/post-new.php1,536 ▲1023.15 ▼0.41687.28 ▲18.9968.55 ▲12.97
Media Library /wp-admin/upload.php1,412 ▲124.20 ▼0.06113.67 ▲8.1347.63 ▲2.59
Sur.ly /wp-admin/surly.php260.420.0920.83

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not 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
The following issues need your attention
  • 13× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/surly/lib/surly-sdk-php/surly/tests/ReplaceTest.php:3
    • > PHP Warning
      require_once(path_to_surly-sdk/Surly.php): failed to open stream: No such file or directory in wp-content/plugins/surly/lib/surly-sdk-php/surly/examples/basic.php on line 16
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/surly/lib/surly-sdk-php/surly/tests/BackupHostTest.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/surly/surly.php:413
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/surly/lib/surly-sdk-php/surly/tests/ShortenerTest.php:3
    • > PHP Fatal error
      require_once(): Failed opening required 'path_to_surly-sdk/Surly.php' (include_path='.:/usr/share/php') in wp-content/plugins/surly/lib/surly-sdk-php/surly/examples/basic.php on line 16
    • > PHP Fatal error
      Uncaught Error: Call to undefined method Surly::_callShortenerServiceCurl() in wp-content/plugins/surly/lib/surly-sdk-php/surly/tests/test-timeouts.php:54
    • > PHP Warning
      Use of undefined constant SURLY_PANEL_URL - assumed 'SURLY_PANEL_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/surly/surly-settings-toolbar.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/surly/surly-settings-toolbar.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/surly/surly-settings-plugin.php:15

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
These are user-side errors you should fix
    • > GET request to /wp-admin/surly.php
    • > Network (severe)
    wp-admin/surly.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Tags: There are too many tags (32 tag instead of maximum 10)
The official readme.txt might help

surly/surly.php 92% from 13 tests

The principal PHP file in "Sur.ly" v. 3.0.3 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Description: The description should be shorter than 140 characters (currently 181 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin5,528 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP156596303,502
CSS36361,129
SVG100655
JavaScript4838242

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity26.33
▷ Minimum class complexity1.00
▷ Maximum class complexity115.00
Average method complexity3.30
▷ Minimum method complexity1.00
▷ Maximum method complexity67.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods99
▷ Static methods00.00%
▷ Public methods9898.99%
▷ Protected methods00.00%
▷ Private methods11.01%
Functions32
▷ Named functions32100.00%
▷ Anonymous functions00.00%
Constants32
▷ Global constants32100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
10 PNG files occupy 0.04MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
static/img/elements/mcheck.png1.10KB0.34KB▼ 69.14%
static/img/toolbar-img.png31.34KB15.14KB▼ 51.70%
static/img/elements/icon-zip-1.png1.04KB0.19KB▼ 82.08%
static/img/elements/icon-settings-1.png1.41KB0.53KB▼ 62.12%
static/img/elements/lightning.png1.27KB0.47KB▼ 62.67%