72% pocket-widget

Code Review | Pocket Widget

WordPress plugin Pocket Widget scored72%from 54 tests.

About plugin

  • Plugin page: pocket-widget
  • Plugin version: 0.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.9
  • WordPress version: 6.3.1
  • First release: Jun 11, 2014
  • Latest release: Nov 12, 2014
  • Number of updates: 4
  • Update frequency: every 38.5 days
  • Top authors: Sjeiti (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,167 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.19MB] [CPU: ▼0.72ms] Passed 4 tests

Analyzing server-side resources used by Pocket Widget
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.66 ▲0.1944.22 ▼1.39
Dashboard /wp-admin3.49 ▲0.1951.42 ▲1.53
Posts /wp-admin/edit.php3.61 ▲0.2549.26 ▲1.80
Add New Post /wp-admin/post-new.php6.07 ▲0.1892.59 ▼4.81
Media Library /wp-admin/upload.php3.42 ▲0.1839.33 ▲2.43
Pocket widget /wp-admin/options-general.php?page=pocketwidget3.3636.38

Server storage [IO: ▲0.06MB] [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, 9 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
widget_pocketwidget
theysaidso_admin_options
pocketwidget_access_token
pocketwidget_consumer_key
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Pocket Widget
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.34 ▼0.031.70 ▼0.2341.19 ▲0.79
Dashboard /wp-admin2,196 ▲165.50 ▼0.0785.21 ▼5.9240.49 ▼7.68
Posts /wp-admin/edit.php2,104 ▲41.97 ▼0.0642.25 ▲3.4335.94 ▼5.63
Add New Post /wp-admin/post-new.php1,531 ▲523.18 ▲0.11659.52 ▲0.2654.14 ▼1.18
Media Library /wp-admin/upload.php1,407 ▲104.20 ▼0.0296.48 ▼6.3345.47 ▲1.79
Pocket widget /wp-admin/options-general.php?page=pocketwidget8582.0123.4126.14

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • pocketwidget_access_token
    • db_upgraded
    • widget_pocketwidget
    • pocketwidget_consumer_key

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These errors were triggered by the plugin
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=pocketwidget
    • > Warning in wp-content/plugins/pocket-widget/inc/HTMLElement.php+16
    count(): Parameter must be an array or an object that implements Countable

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/pocket-widget/authenticate.php
    • > /wp-content/plugins/pocket-widget/callback.php
  • 6× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Notice
      Undefined index: consumer_key in wp-content/plugins/pocket-widget/authenticate.php on line 4
    • > PHP Notice
      Undefined offset: 1 in wp-content/plugins/pocket-widget/authenticate.php on line 29
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/pocket-widget/PocketWidget.php:3
    • > PHP Notice
      Undefined index: callback_uri in wp-content/plugins/pocket-widget/authenticate.php on line 5
    • > PHP Warning
      file_get_contents(https://getpocket.com/v3/oauth/request): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request\r in wp-content/plugins/pocket-widget/authenticate.php on line 26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/pocket-widget/PocketWidgetPlugin.php:32

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Plugin Name: Please specify the plugin name on the first line ( === pocket-widget === )
The official readme.txt is a good inspiration

pocket-widget/PocketWidgetPlugin.php 92% from 13 tests

"Pocket Widget" version 0.1.3's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("pocket-widget.php" instead of "PocketWidgetPlugin.php")

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
No dangerous file extensions were detected856 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP873280774
PO File1183755
JavaScript10027

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity23.80
▷ Minimum class complexity6.00
▷ Maximum class complexity52.00
Average method complexity3.59
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods44
▷ Static methods1125.00%
▷ Public methods2761.36%
▷ Protected methods1227.27%
▷ Private methods511.36%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There were not PNG files found in your plugin