84% ninjateam-telegram

Code Review | NinjaTeam Chat for Telegram

WordPress plugin NinjaTeam Chat for Telegram scored84%from 54 tests.

About plugin

  • Plugin page: ninjateam-telegram
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Apr 2, 2021
  • Latest release: Mar 10, 2023
  • Number of updates: 5
  • Update frequency: every 141.4 days
  • Top authors: ninjateam (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /1,685 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.38MB] [CPU: ▲0.90ms] Passed 4 tests

An overview of server-side resources used by NinjaTeam Chat for Telegram
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4641.92 ▲2.46
Dashboard /wp-admin3.70 ▲0.4052.41 ▲1.36
Posts /wp-admin/edit.php3.75 ▲0.3959.46 ▲10.85
Add New Post /wp-admin/post-new.php6.28 ▲0.4096.31 ▲1.39
Media Library /wp-admin/upload.php3.56 ▲0.3336.62 ▼1.60
Settings /wp-admin/admin.php?page=nta_telegram_setting3.6038.07
Add New account /wp-admin/post-new.php?post_type=telegram-accounts3.7450.80
All Accounts /wp-admin/edit.php?post_type=telegram-accounts3.6041.39
Floating Widget /wp-admin/admin.php?page=nta_telegram_floating_widget3.6639.79

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 58 new files
Database: no new tables, 9 new options
New WordPress options
db_upgraded
njt_tele_version
njt_tele_review
widget_recent-posts
can_compress_scripts
njt_tele_first_time_active
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for NinjaTeam Chat for Telegram
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,966 ▲20514.04 ▼0.359.29 ▲7.5639.40 ▼4.84
Dashboard /wp-admin2,247 ▲445.88 ▲0.98106.06 ▼7.6273.93 ▲31.75
Posts /wp-admin/edit.php2,141 ▲441.97 ▼0.0837.79 ▼1.7936.17 ▲2.29
Add New Post /wp-admin/post-new.php6,229 ▲4,68419.02 ▼4.44949.64 ▲274.2354.03 ▼1.90
Media Library /wp-admin/upload.php1,432 ▲354.17 ▼0.04102.84 ▼16.4069.08 ▲21.28
Settings /wp-admin/admin.php?page=nta_telegram_setting1,1572.7050.4267.27
Add New account /wp-admin/post-new.php?post_type=telegram-accounts5,1554.8492.2394.26
All Accounts /wp-admin/edit.php?post_type=telegram-accounts1,1171.9430.2630.49
Floating Widget /wp-admin/admin.php?page=nta_telegram_floating_widget2,5889.50191.2035.80

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_theysaidso_widget
    • njt_tele_first_time_active
    • db_upgraded
    • widget_recent-posts
    • njt_tele_version
    • widget_recent-comments
    • njt_tele_review
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 10× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ninjateam-telegram/views/woocommerce-button.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ninjateam-telegram/views/design-settings.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ninjateam-telegram/views/display-settings.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ninjateam-telegram/views/meta-accounts.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'NTA_Telegram\\Helper' not found in wp-content/plugins/ninjateam-telegram/views/selected-accounts.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_errors() in wp-content/plugins/ninjateam-telegram/views/floating-widget-settings.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ninjateam-telegram/views/analytics.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_errors() in wp-content/plugins/ninjateam-telegram/views/settings.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ninjateam-telegram/views/meta-button-style.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'NTA_Telegram\\Helper' not found in wp-content/plugins/ninjateam-telegram/views/design-preview.php:36

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 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
8 plugin tags: woocommerce telegram, join chat, click to chat, wp social chat, wp telegram...

ninjateam-telegram/telegram.php 92% from 13 tests

The main PHP file in "NinjaTeam Chat for Telegram" ver. 1.0 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("ninjateam-telegram.php" instead of "telegram.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin4,906 lines of code in 48 files:
LanguageFilesBlank linesComment linesLines of code
CSS6226482,260
PHP24275492,190
PO File1103104252
JavaScript8413164
XML10021
SVG71115
JSON1004

PHP code Passed 2 tests

Analyzing 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.33
Average class complexity11.75
▷ Minimum class complexity1.00
▷ Maximum class complexity25.00
Average method complexity2.25
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes12
▷ Abstract classes00.00%
▷ Concrete classes12100.00%
▷ Final classes00.00%
Methods100
▷ Static methods3232.00%
▷ Public methods9292.00%
▷ Protected methods00.00%
▷ Private methods88.00%
Functions8
▷ Named functions450.00%
▷ Anonymous functions450.00%
Constants4
▷ Global constants4100.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
7 PNG files occupy 0.07MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/img/woo_settings/after_short_desc.png1.41KB1.42KB0.00%
assets/img/woo_settings/after_long_desc.png1.44KB1.43KB0.20%
assets/img/woo_settings/before_add_to_cart.png1.41KB1.42KB0.00%
assets/img/FB_Wireframe.png10.56KB4.88KB▼ 53.83%
assets/img/filebird-recommended.png20.96KB10.34KB▼ 50.67%