10% comment-pub

Code Review | Comment Pub

WordPress plugin Comment Pub scored10%from 54 tests.

About plugin

  • Plugin page: comment-pub
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4.1-3.5.1
  • WordPress version: 6.3.1
  • First release: Jan 28, 2013
  • Latest release: Jan 28, 2013
  • Number of updates: 10
  • Update frequency: every 0.2 days
  • Top authors: nowmediagroup (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

40+ active /6,004 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/comment-pub/comment_pub.php+58
    Trying to access array offset on value of type bool

Server metrics [RAM: ▼1.96MB] [CPU: ▼52.31ms] Passed 4 tests

An overview of server-side resources used by Comment Pub
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.03 ▼1.434.82 ▼36.60
Dashboard /wp-admin2.05 ▼1.266.38 ▼47.20
Posts /wp-admin/edit.php2.05 ▼1.316.65 ▼39.40
Add New Post /wp-admin/post-new.php2.05 ▼3.846.23 ▼86.05
Media Library /wp-admin/upload.php2.05 ▼1.187.85 ▼25.70
All Comments /wp-admin/edit-comments.php2.055.84
Comment Pub /wp-admin/edit-comments.php?page=comment_pub_sorting2.058.59
Comment Pub Options /wp-admin/options-general.php?page=comment_pub_options2.057.28

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 13 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
nmg_comment_pub
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Comment Pub
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,823 ▲8813.79 ▼0.501.62 ▼0.1740.08 ▼1.69
Dashboard /wp-admin2,226 ▲375.79 ▼0.15106.02 ▼5.1640.97 ▼7.45
Posts /wp-admin/edit.php2,112 ▲232.00 ▼0.0439.63 ▼1.9634.85 ▲0.55
Add New Post /wp-admin/post-new.php1,551 ▲3723.36 ▲5.87599.02 ▼81.5554.01 ▲10.10
Media Library /wp-admin/upload.php1,414 ▲234.25 ▲0.0898.34 ▲0.5040.82 ▼4.63
All Comments /wp-admin/edit-comments.php1,8182.3035.8636.49
Comment Pub /wp-admin/edit-comments.php?page=comment_pub_sorting1,2282.0723.2931.52
Comment Pub Options /wp-admin/options-general.php?page=comment_pub_options9002.0725.4132.69

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
You still need to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • nmg_comment_pub
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget

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
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=comment_pub_options
    • > Notice in wp-content/plugins/comment-pub/comment_pub.php+80
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/edit-comments.php?page=comment_pub_sorting
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.)
    • > GET request to /wp-admin/edit-comments.php?page=comment_pub_sorting
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query does not contain the correct number of placeholders (0) for the number of arguments passed (2). Please see Debugging in WordPress for more information. (This message was added in version 4.8.3.)
    • > GET request to /wp-admin/edit-comments.php?page=comment_pub_sorting
    • > Notice in wp-content/plugins/comment-pub/comments_pub_sorting.php+689
    Undefined variable: comment_status
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=comment_pub_options
    • > Notice in wp-content/plugins/comment-pub/comments_pub_admin.php+214
    Undefined variable: loveShare

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/comment-pub/comments_pub_sorting.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function post_password_required() in wp-content/plugins/comment-pub/comments_pub_comments.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/comment-pub/comment_pub_page.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/comment-pub/comments_pub_admin.php:6
    • > PHP Warning
      require_once(ABSPATHwp-admin/admin.php): failed to open stream: No such file or directory in wp-content/plugins/comment-pub/comments_pub_sorting.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/comment-pub/comment_pub.php:42
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/admin.php' (include_path='.:/usr/share/php') in wp-content/plugins/comment-pub/comments_pub_sorting.php on line 2

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
5 plugin tags: image upload, resize images, guestbook, guest, comments

comment-pub/comment_pub.php 85% from 13 tests

The main PHP file in "Comment Pub" ver. 1.0.0 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 421 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("comment-pub.php" instead of "comment_pub.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected1,038 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP6496520944
CSS22464
JavaScript218530

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity20.50
▷ Minimum class complexity1.00
▷ Maximum class complexity40.00
Average method complexity3.11
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods38
▷ Static methods00.00%
▷ Public methods3694.74%
▷ Protected methods00.00%
▷ Private methods25.26%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG files were detected