78% cnews

Code Review | CNews

WordPress plugin CNews scored78%from 54 tests.

About plugin

  • Plugin page: cnews
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.6
  • WordPress version: 6.3.1
  • First release: Aug 28, 2016
  • Latest release: Aug 29, 2016
  • Number of updates: 8
  • Update frequency: every 0.8 days
  • Top authors: caspersch (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /595 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.16MB] [CPU: ▼6.70ms] Passed 4 tests

A check of server-side resources used by CNews
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1441.74 ▼0.76
Dashboard /wp-admin3.46 ▲0.1550.93 ▼2.74
Posts /wp-admin/edit.php3.57 ▲0.2143.87 ▼7.85
Add New Post /wp-admin/post-new.php6.25 ▲0.3681.90 ▼15.46
Media Library /wp-admin/upload.php3.38 ▲0.1539.14 ▲2.06
CNews /wp-admin/options-general.php?page=cnews-settings3.3230.65

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 30 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
cnews_settings
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by CNews
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,844 ▲5813.30 ▼0.911.94 ▼0.0241.50 ▼4.58
Dashboard /wp-admin2,225 ▲225.88 ▲1.01100.79 ▼14.2340.18 ▼2.66
Posts /wp-admin/edit.php2,101 ▲42.02 ▼0.0139.39 ▲3.5135.42 ▼0.25
Add New Post /wp-admin/post-new.php6,679 ▲5,12922.22 ▲3.76927.37 ▲235.71125.96 ▲68.03
Media Library /wp-admin/upload.php1,404 ▲44.25 ▼0.0498.45 ▼8.6241.25 ▼3.68
CNews /wp-admin/options-general.php?page=cnews-settings9832.0524.9230.91

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 50% 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)
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=cnews-settings
    • > Warning in wp-admin/includes/template.php+1824
    call_user_func() expects parameter 1 to be a valid callback, class 'SettingsCtrl' does not have a method 'render_input_field'
  • 11 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=cnews-settings
    • > Notice in wp-content/plugins/cnews/controller/class-settings-ctrl.php+262
    Undefined index: field_id
  • 11 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=cnews-settings
    • > Notice in wp-content/plugins/cnews/controller/class-settings-ctrl.php+264
    Undefined variable: value

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
Please take a closer look at the following
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/cnews/view/view-news-email-form-meta-box.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/cnews/view/view-user-profile-field.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cnews/util/class-admin-notice-utility.php:65
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/cnews/view/view-emails-sent-meta-box.php:57

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Add descriptions for screenshots #4, #0, #0, #0, #0 in cnews/assets to your readme.txt
The official readme.txt might help

cnews/cnews.php Passed 13 tests

This is the main PHP file of "CNews" version 1.0.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
125 characters long description:
Send out html emails to user groups from the add/edit post screens, and view emails sent out from that post on the same page.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected972 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
PHP13328769714
PO File13537114
CSS120591
JSON10019
Markdown115019
JavaScript17415

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity8.12
▷ Minimum class complexity1.00
▷ Maximum class complexity26.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods57
▷ Static methods47.02%
▷ Public methods5291.23%
▷ Protected methods11.75%
▷ Private methods47.02%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
8 PNG files occupy 0.61MB with 0.43MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot3.png44.09KB13.17KB▼ 70.14%
screenshot-4.png111.02KB31.98KB▼ 71.20%
screenshot-1.png60.84KB17.39KB▼ 71.42%
screenshot1.png60.84KB17.39KB▼ 71.42%
screenshot-2.png44.09KB13.17KB▼ 70.14%