68% bjh-site-assistant

Code Review | BJH Website Assistant

WordPress plugin BJH Website Assistant scored68%from 54 tests.

About plugin

  • Plugin page: bjh-site-assistant
  • Plugin version: 1.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.7
  • WordPress version: 6.3.1
  • First release: Feb 28, 2016
  • Latest release: Dec 24, 2016
  • Number of updates: 9
  • Update frequency: every 33.6 days
  • Top authors: bjhee (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,110 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▼1.14MB] [CPU: ▼45.90ms] Passed 4 tests

A check of server-side resources used by BJH Website Assistant
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.83 ▼0.6316.90 ▼22.90
Dashboard /wp-admin2.88 ▼0.4316.42 ▼34.85
Posts /wp-admin/edit.php2.88 ▼0.4818.33 ▼29.88
Add New Post /wp-admin/post-new.php2.88 ▼3.0117.00 ▼94.64
Media Library /wp-admin/upload.php2.88 ▼0.3514.18 ▼24.23
BJH Site Assistant /wp-admin/options-general.php?page=bjh_sa_page2.8817.39

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

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

Browser metrics Passed 4 tests

A check of browser resources used by BJH Website Assistant
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,830 ▲6914.23 ▼0.052.05 ▼0.0243.40 ▼0.29
Dashboard /wp-admin2,202 ▲255.52 ▼0.1385.42 ▼3.8740.49 ▼1.04
Posts /wp-admin/edit.php2,113 ▲131.97 ▲0.0139.49 ▲3.5637.05 ▲0.79
Add New Post /wp-admin/post-new.php1,535 ▲122.97 ▲4.73695.69 ▲5.4956.14 ▼14.50
Media Library /wp-admin/upload.php1,410 ▲134.26 ▲0.0895.33 ▼37.8042.63 ▼3.90
BJH Site Assistant /wp-admin/options-general.php?page=bjh_sa_page9222.1522.6029.61

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/bjh-site-assistant/inc/util.php+45
    Undefined index: bsa_font
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=bjh_sa_page
    • > Notice in wp-content/plugins/bjh-site-assistant/inc/util.php+26
    Undefined index: bsa_font
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=bjh_sa_page
    • > Notice in wp-content/plugins/bjh-site-assistant/inc/util.php+26
    Undefined index: bsa_avatar
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=bjh_sa_page
    • > Notice in wp-content/plugins/bjh-site-assistant/inc/util.php+45
    Undefined index: bsa_baidu_submit
    • > GET request to /wp-admin/options-general.php?page=bjh_sa_page
    • > Notice in wp-content/plugins/bjh-site-assistant/inc/util.php+51
    Undefined index: bsa_baidu_token
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=bjh_sa_page
    • > Notice in wp-content/plugins/bjh-site-assistant/inc/util.php+45
    Undefined index: bsa_head_script
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=bjh_sa_page
    • > Notice in wp-content/plugins/bjh-site-assistant/inc/util.php+45
    Undefined index: bsa_copyright

SRP 50% 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
  • 34× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Warning
      require_once(BSA_PATHinc/constants.php): failed to open stream: No such file or directory in wp-content/plugins/bjh-site-assistant/inc/util.php on line 2
    • > PHP Warning
      require_once(BSA_PATHinc/util.php): failed to open stream: No such file or directory in wp-content/plugins/bjh-site-assistant/func/bjh-head-script.php on line 2
    • > PHP Warning
      require_once(BSA_PATHinc/constants.php): failed to open stream: No such file or directory in wp-content/plugins/bjh-site-assistant/settings.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'BSA_PATHinc/util.php' (include_path='.:/usr/share/php') in wp-content/plugins/bjh-site-assistant/func/bjh-meta.php on line 2
    • > PHP Warning
      Use of undefined constant BSA_PATH - assumed 'BSA_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/bjh-site-assistant/func/bjh-font.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'BSA_PATHinc/util.php' (include_path='.:/usr/share/php') in wp-content/plugins/bjh-site-assistant/func/bjh-copyright.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'BSA_PATHinc/constants.php' (include_path='.:/usr/share/php') in wp-content/plugins/bjh-site-assistant/init.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'BSA_PATHinc/util.php' (include_path='.:/usr/share/php') in wp-content/plugins/bjh-site-assistant/func/bjh-head-script.php on line 2
    • > PHP Fatal error
      require_once(): Failed opening required 'BSA_PATHinc/util.php' (include_path='.:/usr/share/php') in wp-content/plugins/bjh-site-assistant/func/bjh-captcha.php on line 2
    • > PHP Warning
      Use of undefined constant BSA_PATH - assumed 'BSA_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/bjh-site-assistant/settings.php on line 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)
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Screenshots: Add an image for screenshot #1 (Enable or disable the functions by settings)
You can take inspiration from this readme.txt

bjh-site-assistant/bjh-site-assistant.php Passed 13 tests

"BJH Website Assistant" version 1.3.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
87 characters long description:
The WordPress plugin that provides small functions to help your website working better.

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
Success! There were no dangerous files found in this plugin687 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
PHP13120174510
PO File1222266
Markdown129065
JavaScript23232
CSS21114

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity4.09
▷ Minimum class complexity1.00
▷ Maximum class complexity10.00
Average method complexity1.67
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods51
▷ Static methods4792.16%
▷ Public methods51100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants24
▷ Global constants28.33%
▷ Class constants2291.67%
▷ Public constants22100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 PNG files occupy 0.10MB with 0.07MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
image/top.png1.55KB0.54KB▼ 64.90%
image/default.png4.66KB1.76KB▼ 62.20%
screenshot-1.png100.15KB27.45KB▼ 72.59%