83% posts-widget

Code Review | GS Posts Widget

WordPress plugin GS Posts Widget scored 83% from 54 tests.

About plugin

  • Plugin page: posts-widget
  • Plugin version: 1.2.8
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-6.3
  • WordPress version: 6.3.1
  • First release: Jun 15, 2017
  • Latest release: Aug 30, 2023
  • Number of updates: 37
  • Update frequency: every 133.8 days
  • Top authors: samdani (97.3%)aaroncampbell (5.41%)

Code review

54 tests

User reviews

4 reviews

Install metrics

500+ active / 9,091 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 successfully, without throwing any errors or notices

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

Server-side resources used by GS Posts Widget
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0437.31 ▼6.30
Dashboard /wp-admin3.34 ▲0.0346.00 ▼4.31
Posts /wp-admin/edit.php3.39 ▲0.0350.14 ▲2.78
Add New Post /wp-admin/post-new.php5.94 ▲0.0595.52 ▲4.03
Media Library /wp-admin/upload.php3.26 ▲0.0337.90 ▲4.03

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 13 new files
Database: no new tables, 7 new options
New WordPress options
widget_gs-posts-widget
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
db_upgraded
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for GS Posts Widget
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,831 ▲9613.23 ▼1.441.76 ▼0.0941.92 ▼9.26
Dashboard /wp-admin2,232 ▲445.83 ▼0.0794.72 ▼18.7838.82 ▼10.30
Posts /wp-admin/edit.php2,118 ▲322.10 ▲0.0940.30 ▲4.4237.79 ▲2.29
Add New Post /wp-admin/post-new.php1,552 ▲1618.17 ▼5.01605.44 ▼60.8553.49 ▼6.98
Media Library /wp-admin/upload.php1,417 ▲294.26 ▲0.1096.28 ▼13.7842.72 ▼5.39

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin does not fully uninstall, leaving 7 options in the database
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_gs-posts-widget
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

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 fix the following items
  • 9× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Notice
      Undefined variable: instance in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp4-grid-02A.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to a member function have_posts() on null in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp3-grid-01.php:17
    • > PHP Notice
      Undefined variable: instance in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp3-grid-01.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_image_size() in wp-content/plugins/posts-widget/gspw-posts-widget.php:23
    • > PHP Notice
      Undefined variable: gspw_query in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp4-grid-02A.php on line 17
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp3-grid-01.php on line 9
    • > PHP Notice
      Undefined variable: gspw_query in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp3-grid-01.php on line 17
    • > PHP Fatal error
      Uncaught Error: Call to a member function have_posts() on null in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp4-grid-02A.php:17
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/posts-widget/gspw-files/templates/gspwtemp4-grid-02A.php on line 9

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 errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 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
5 plugin tags: categories, posts, sidebar, recent posts, widget

posts-widget/gspw-posts-widget.php 77% from 13 tests

The main file in "GS Posts Widget" v. 1.2.8 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 437 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("posts-widget.php" instead of "gspw-posts-widget.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

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 plugin2,634 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP75546502,442
CSS253167
JSON10021
JavaScript1104

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity53.60
▷ Minimum class complexity5.00
▷ Maximum class complexity100.00
Average method complexity3.51
▷ Minimum method complexity1.00
▷ Maximum method complexity62.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods93
▷ Static methods11.08%
▷ Public methods5963.44%
▷ Protected methods66.45%
▷ Private methods2830.11%
Functions14
▷ Named functions1285.71%
▷ Anonymous functions214.29%
Constants0
▷ Global constants00.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
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
gspw-files/admin/css/icon-128x128.png5.04KB4.34KB▼ 13.92%