78% hatedetect

Code Review | HateDetect

WordPress plugin HateDetect scored78%from 54 tests.

About plugin

  • Plugin page: hatedetect
  • Plugin version: 0.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.8
  • WordPress version: 6.3.1
  • First release: Nov 4, 2021
  • Latest release: Nov 26, 2021
  • Number of updates: 11
  • Update frequency: every 2.1 days
  • Top authors: qqkk (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /475 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.23MB] [CPU: ▼4.00ms] Passed 4 tests

Analyzing server-side resources used by HateDetect
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1241.88 ▼3.87
Dashboard /wp-admin3.57 ▲0.2753.22 ▼2.04
Posts /wp-admin/edit.php3.68 ▲0.3357.94 ▲7.33
Add New Post /wp-admin/post-new.php6.15 ▲0.2696.46 ▼8.53
Media Library /wp-admin/upload.php3.49 ▲0.2638.56 ▼1.54
HateDetect /wp-admin/options-general.php?page=hatedetect-key-config3.4637.23

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 12 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
widget_recent-comments
hatedetect_key_status
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for HateDetect
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,862 ▲11614.27 ▲0.011.71 ▼0.3833.04 ▼10.07
Dashboard /wp-admin2,240 ▲635.65 ▲0.0293.27 ▼6.1443.99 ▼2.79
Posts /wp-admin/edit.php2,104 ▲72.14 ▲0.1140.75 ▲2.6233.80 ▼1.84
Add New Post /wp-admin/post-new.php1,529 ▲123.78 ▲0.52668.32 ▼30.2952.36 ▼0.82
Media Library /wp-admin/upload.php1,404 ▲44.21 ▼0.05101.20 ▼12.4042.74 ▼5.52
HateDetect /wp-admin/options-general.php?page=hatedetect-key-config8692.0424.4433.08

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/hatedetect/HateDetect.php
  • 14× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 42
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/hatedetect/views/title.php:2
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 22
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 61
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 73
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 7
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 69
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 49
    • > PHP Notice
      Undefined variable: type in wp-content/plugins/hatedetect/views/notice.php on line 65
    • > PHP Fatal error
      Uncaught Error: Class 'Hatedetect_Admin' not found in wp-content/plugins/hatedetect/views/start.php:16

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 on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
9 plugin tags: anti hate, antihate, hatedetect, hatecheck, hate-detection...

hatedetect/HateDetect.php 92% from 13 tests

The main file in "HateDetect" v. 0.1.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("hatedetect.php" instead of "HateDetect.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin2,042 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP92553481,418
CSS11093576
JavaScript115648

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity68.33
▷ Minimum class complexity21.00
▷ Maximum class complexity101.00
Average method complexity4.67
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods55
▷ Static methods55100.00%
▷ Public methods5294.55%
▷ Protected methods00.00%
▷ Private methods35.45%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants228.57%
▷ Class constants571.43%
▷ Public constants5100.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
No PNG files were detected