62% stock-market-news

Code Review | Stock Market News

WordPress plugin Stock Market News scored 62% from 54 tests.

About plugin

  • Plugin page: stock-market-news
  • Plugin version: 1.9.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-5.7.1
  • WordPress version: 5.8.1
  • First release: Jan 16, 2017
  • Latest release: May 3, 2021
  • Number of updates: 50
  • Update frequency: every 31.3 days
  • Top authors: stockdio (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

1,000+ active / 17,222 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▼0.55MB] [CPU: ▼204.05ms] Passed 4 tests

This is a short check of server-side resources used by Stock Market News
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.07 ▲0.2331.36 ▲6.08
Dashboard /wp-admin3.11 ▲0.0417.07 ▼21.40
Posts /wp-admin/edit.php3.11 ▼0.0018.66 ▼20.43
Add New Post /wp-admin/post-new.php3.11 ▼2.3317.39 ▼770.14
Media Library /wp-admin/upload.php3.11 ▲0.1019.16 ▼4.23
Stock Market News /wp-admin/options-general.php?page=stockdio-news-board-settings-config3.1116.18

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 24 new files
Database: no new tables, 1 new option
New WordPress options
widget_widget_stockdio_market_news

Browser metrics Passed 4 tests

A check of browser resources used by Stock Market News
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,781 ▲15419.92 ▲4.767.48 ▲1.1789.30 ▲10.98
Dashboard /wp-admin2,986 ▲889.69 ▲3.41216.39 ▲84.52176.32 ▼4.08
Posts /wp-admin/edit.php2,831 ▲917.82 ▲4.58113.65 ▲45.04143.45 ▲0.90
Add New Post /wp-admin/post-new.php1,552 ▼2,25621.82 ▲3.21366.74 ▼150.49169.23 ▼0.39
Media Library /wp-admin/upload.php1,824 ▲729.92 ▲4.39189.80 ▲35.61206.33 ▲25.36
Stock Market News /wp-admin/options-general.php?page=stockdio-news-board-settings-config1,1667.97104.15114.84

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/stock-market-news/stockdio_news_stockdioplugin.php+115
    Trying to access array offset on value of type bool
  • The uninstall procedure has failed, leaving 1 option in the database
    • widget_widget_stockdio_market_news

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=stockdio-news-board-settings-config
    • > Notice in wp-content/plugins/stock-market-news/stockdio_news_stockdioplugin.php+38
    Trying to access array offset on value of type bool

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
Almost there! Just fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/stock-market-news/stockdio_news_activate_plugin_settings.php
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/stock-market-news/stockdio_news_overview_widget.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/stock-market-news/stockdio_news_stockdioplugin.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/stock-market-news/stockdio_news_activate_plugin_admin.php:2

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 issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Tags: Too many tags (18 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

stock-market-news/stockdio_news_stockdioplugin.php 92% from 13 tests

The principal PHP file in "Stock Market News" v. 1.9.5 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("stock-market-news.php" instead of "stockdio_news_stockdioplugin.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin4,293 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript6199511,803
PHP52011041,371
CSS590281,109
SVG11010

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
These items need your attention
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 103)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity101.00
▷ Minimum class complexity72.00
▷ Maximum class complexity130.00
Average method complexity6.26
▷ Minimum method complexity1.00
▷ Maximum method complexity103.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods38
▷ Static methods513.16%
▷ Public methods38100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions18
▷ Named functions1688.89%
▷ Anonymous functions211.11%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.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
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/stockdio-logo-full-dark.png14.07KB5.39KB▼ 61.70%
assets/stockdio-logo-full-light.png11.00KB5.38KB▼ 51.07%