57% ngsurvey

Code Review | NgSurvey - Powerful, feature rich self-hosted surveys

WordPress plugin NgSurvey - Powerful, feature rich self-hosted surveys scored57%from 54 tests.

About plugin

  • Plugin page: ngsurvey
  • Plugin version: 1.2.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.4
  • WordPress version: 6.3.1
  • First release: Jun 12, 2021
  • Latest release: Oct 28, 2023
  • Number of updates: 23
  • Update frequency: every 37.8 days
  • Top authors: ngideas (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,546 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.27MB] [CPU: ▼5.56ms] Passed 4 tests

A check of server-side resources used by NgSurvey - Powerful, feature rich self-hosted surveys
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.3135.92 ▼2.73
Dashboard /wp-admin3.60 ▲0.2642.83 ▼15.30
Posts /wp-admin/edit.php3.65 ▲0.2945.38 ▼3.29
Add New Post /wp-admin/post-new.php6.22 ▲0.3491.60 ▲2.91
Media Library /wp-admin/upload.php3.46 ▲0.2334.75 ▼0.93
Edit Questions /wp-admin/admin.php?page=edit_questions3.4030.42
Answer Presets /wp-admin/edit.php?post_type=ngpreset3.5936.04
Settings /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_settings3.3325.07
Categories /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey3.4533.03
Extensions /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_extensions3.3325.44
View Reports /wp-admin/admin.php?page=view_reports3.4030.31

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 619 new files
Database: 10 new tables, 9 new options
New tables
wp_ngs_tracking
wp_ngs_pages_questions_map
wp_ngs_questions
wp_ngs_responses
wp_ngs_invitations
wp_ngs_rules
wp_ngs_pages
wp_ngs_answers
wp_ngs_response_details
wp_ngs_countries
New WordPress options
widget_recent-comments
widget_theysaidso_widget
db_upgraded
ngsurvey_licenses
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
ngsurvey_general_settings
ngsurvey_version

Browser metrics Passed 4 tests

NgSurvey - Powerful, feature rich self-hosted surveys: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,841 ▲9514.17 ▼0.191.65 ▲0.0637.36 ▼5.00
Dashboard /wp-admin2,235 ▲615.52 ▼0.0182.47 ▼4.0335.96 ▼6.58
Posts /wp-admin/edit.php2,143 ▲402.01 ▲0.0239.21 ▼5.6036.56 ▼2.32
Add New Post /wp-admin/post-new.php1,573 ▲4518.16 ▼5.02604.58 ▼99.9265.69 ▲10.16
Media Library /wp-admin/upload.php1,440 ▲374.19 ▲0.0395.92 ▼3.7240.31 ▼3.79
Edit Questions /wp-admin/admin.php?page=edit_questions7071.516.6313.67
Answer Presets /wp-admin/edit.php?post_type=ngpreset1,2114.5781.7128.11
Settings /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_settings280.420.093.77
Categories /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey1,3202.1225.0028.66
Extensions /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_extensions280.420.073.64
View Reports /wp-admin/admin.php?page=view_reports7071.246.7817.71

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • The plugin did not uninstall successfully, leaving 10 tables in the database
    • wp_ngs_pages
    • wp_ngs_countries
    • wp_ngs_answers
    • wp_ngs_pages_questions_map
    • wp_ngs_invitations
    • wp_ngs_response_details
    • wp_ngs_responses
    • wp_ngs_rules
    • wp_ngs_questions
    • wp_ngs_tracking
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • widget_theysaidso_widget
    • can_compress_scripts
    • ngsurvey_licenses
    • ngsurvey_general_settings
    • widget_recent-comments
    • ngsurvey_version
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=view_reports
    • > Notice in wp-content/plugins/ngsurvey/admin/controllers/class-controller-reports.php+46
    Undefined index: _wpnonce

SRP 0% 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
The following issues need your attention
  • 4× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/ngsurvey/includes/lib/vendor/mustangostang/spyc/php4/5to4.php
    • > /wp-content/plugins/ngsurvey/includes/lib/vendor/mustangostang/spyc/examples/yaml-load.php
    • > /wp-content/plugins/ngsurvey/templates/public/common/loader.php
    • > /wp-content/plugins/ngsurvey/admin/views/ngsurvey-admin-display.php
  • 249× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php:34
    • > PHP Fatal error
      Uncaught Error: Class 'DeviceDetector\\Parser\\Client\\AbstractClientParser' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/matomo/device-detector/Parser/Client/Browser.php:26
    • > PHP Fatal error
      Uncaught Error: Interface 'Sabberworm\\CSS\\Property\\AtRule' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/sabberworm/php-css-parser/src/Property/Import.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractProcessingHandler' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Action_Scheduler\\Migration\\ActionMigrator' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/woocommerce/action-scheduler/classes/migration/DryRun_ActionMigrator.php:15
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\CssSelector\\XPath\\TranslatorInterface' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/symfony/css-selector/XPath/Translator.php:31
    • > PHP Fatal error
      Uncaught Error: Interface 'Sabberworm\\CSS\\Renderable' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/sabberworm/php-css-parser/src/CSSList/CSSList.php:32
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_Store' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/woocommerce/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'Pelago\\Emogrifier\\HtmlProcessor\\AbstractHtmlProcessor' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/pelago/emogrifier/src/HtmlProcessor/HtmlPruner.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'DeviceDetector\\Parser\\AbstractBotParser' not found in wp-content/plugins/ngsurvey/includes/lib/vendor/matomo/device-detector/Parser/Bot.php:22

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please fix the following user-side errors
    • > GET request to /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_settings
    • > Network (severe)
    wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_settings - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_extensions
    • > Network (severe)
    wp-admin/edit-tags.php?taxonomy=ngsurveys&post_type=ngsurvey&page=ngsurvey_extensions - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
5 plugin tags: forms, polls, survey, feedback forms, surveys

ngsurvey/ngsurvey.php 92% from 13 tests

The main PHP file in "NgSurvey - Powerful, feature rich self-hosted surveys" ver. 1.2.0 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Description: Please don't use more than 140 characters for the plugin description (currently 143 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin102,961 lines of code in 569 files:
LanguageFilesBlank linesComment linesLines of code
YAML253,5442,83441,828
PHP4678,15522,79036,182
CSS1421511113,129
JavaScript248789037,613
Markdown1870002,455
JSON15001,622
XML51913130
INI1002

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity10.90
▷ Minimum class complexity1.00
▷ Maximum class complexity263.00
Average method complexity2.56
▷ Minimum method complexity1.00
▷ Maximum method complexity50.00
Code structure
Namespaces48
Interfaces25
Traits5
Classes379
▷ Abstract classes4211.08%
▷ Concrete classes33788.92%
▷ Final classes51.48%
Methods2,661
▷ Static methods2168.12%
▷ Public methods2,02476.06%
▷ Protected methods38114.32%
▷ Private methods2569.62%
Functions81
▷ Named functions3644.44%
▷ Anonymous functions4555.56%
Constants189
▷ Global constants2312.17%
▷ Class constants16687.83%
▷ Public constants12675.90%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
5 compressed PNG files occupy 0.01MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/vendor/leaflet/images/layers.png0.68KB1.05KB0.00%
assets/vendor/leaflet/images/marker-icon.png1.43KB1.55KB0.00%
assets/vendor/leaflet/images/layers-2x.png1.23KB1.67KB0.00%
assets/vendor/leaflet/images/marker-icon-2x.png2.41KB2.52KB0.00%
assets/vendor/leaflet/images/marker-shadow.png0.60KB1.16KB0.00%