84% guardian-news-headlines

Code Review | Guardian News Headlines

WordPress plugin Guardian News Headlines scored84%from 54 tests.

About plugin

  • Plugin page: guardian-news-hea...
  • Plugin version: 0.5.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.4.2
  • WordPress version: 6.3.1
  • First release: Nov 19, 2012
  • Latest release: Nov 3, 2014
  • Number of updates: 10
  • Update frequency: every 71.4 days
  • Top authors: openplatform (90%)NealMcConachie (20%)

Code review

54 tests

User reviews

2 reviews

Install metrics

30+ active /6,588 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.02MB] [CPU: ▼6.56ms] Passed 4 tests

Server-side resources used by Guardian News Headlines
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0343.33 ▼3.02
Dashboard /wp-admin3.33 ▲0.0349.20 ▲0.18
Posts /wp-admin/edit.php3.38 ▲0.0247.47 ▼5.38
Add New Post /wp-admin/post-new.php5.91 ▲0.0286.20 ▼13.05
Media Library /wp-admin/upload.php3.25 ▲0.0234.81 ▼4.77

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 23 new files
Database: 1 new table, 10 new options
New tables
wp_guardian_headlines
New WordPress options
db_upgraded
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
guardian_headlines_version
guardian_headlines_sections
widget_recent-comments
guardian_headlines_notified
widget_guardian_headlines_widget
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Guardian News Headlines
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,807 ▲2114.56 ▲0.301.74 ▼0.1545.15 ▼3.13
Dashboard /wp-admin2,200 ▲235.66 ▼0.0190.24 ▼10.1342.08 ▼5.35
Posts /wp-admin/edit.php2,099 ▼41.98 ▼0.0236.15 ▼9.3935.79 ▼2.01
Add New Post /wp-admin/post-new.php1,528 ▲223.63 ▲0.64691.06 ▲4.3157.44 ▼7.50
Media Library /wp-admin/upload.php1,402 ▲24.23 ▲0.1098.55 ▼18.4544.89 ▼4.37

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
These items require your attention
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • widget_guardian_headlines_widget
    • db_upgraded

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)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 5× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in wp-content/plugins/guardian-news-headlines/gu_widget.php on line 26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/guardian-news-headlines/guardian_headlines.php:30
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHWPINC/widgets.php' (include_path='.:/usr/share/php') in wp-content/plugins/guardian-news-headlines/gu_widget.php on line 26
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/guardian-news-headlines/gu_widget.php on line 26
    • > PHP Warning
      require_once(ABSPATHWPINC/widgets.php): failed to open stream: No such file or directory in wp-content/plugins/guardian-news-headlines/gu_widget.php on line 26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

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 your attention:
  • Screenshots: These screenshots require images: #1 (The widget settings panel), #2 (Available news categories), #3 (The resulting widget), #4 (Changing to most-viewed), #5 (Different feed results for most-viewed articles), #6 (The widget on a dark background)
You can look at the official readme.txt

guardian-news-headlines/guardian_headlines.php 92% from 13 tests

The main PHP file in "Guardian News Headlines" ver. 0.5.4 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("guardian-news-headlines.php" instead of "guardian_headlines.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected496 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP4119178405
CSS29062
JSON10029

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity9.50
▷ Minimum class complexity2.00
▷ Maximum class complexity29.00
Average method complexity2.42
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods24
▷ Static methods00.00%
▷ Public methods1979.17%
▷ Protected methods00.00%
▷ Private methods520.83%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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.37MB with 0.21MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png53.58KB18.77KB▼ 64.97%
img/poweredbyguardianWHITE.png1.78KB1.04KB▼ 41.34%
screenshot-5.png40.55KB12.74KB▼ 68.59%
img/poweredbyguardianREV.png1.95KB1.19KB▼ 38.87%
screenshot-4.png53.12KB18.73KB▼ 64.73%