10% azure-cognitive-service-personalizer

Code Review | Azure Cognitive Service Personalizer

WordPress plugin Azure Cognitive Service Personalizer scored10%from 54 tests.

About plugin

  • Plugin page: azure-cognitive-s...
  • Plugin version: 1.0
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.3
  • WordPress version: 6.3.1
  • First release: Dec 8, 2019
  • Latest release: Dec 16, 2019
  • Number of updates: 4
  • Update frequency: every 5.3 days
  • Top authors: eisbermsft (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /615 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The following installer errors require your attention
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/azure-cognitive-service-personalizer/widget_rank.php+292
    Function create_function() is deprecated

Server metrics [RAM: ▼1.82MB] [CPU: ▼54.31ms] Passed 4 tests

Server-side resources used by Azure Cognitive Service Personalizer
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.17 ▼1.295.41 ▼35.60
Dashboard /wp-admin2.19 ▼1.158.00 ▼50.02
Posts /wp-admin/edit.php2.19 ▼1.166.29 ▼42.56
Add New Post /wp-admin/post-new.php2.19 ▼3.696.55 ▼89.07
Media Library /wp-admin/upload.php2.19 ▼1.046.08 ▼30.24

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Azure Cognitive Service Personalizer
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,885 ▲13913.93 ▼0.487.81 ▲5.9239.86 ▲0.44
Dashboard /wp-admin2,211 ▲205.86 ▲1.0196.97 ▼3.2640.30 ▼1.92
Posts /wp-admin/edit.php2,088 ▼12.02 ▼0.0232.88 ▼4.1333.60 ▼1.75
Add New Post /wp-admin/post-new.php1,535 ▲2123.31 ▲5.76647.54 ▼7.9453.62 ▲3.15
Media Library /wp-admin/upload.php1,390 ▲54.22 ▲0.0194.88 ▼28.6340.18 ▼7.81

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/azure-cognitive-service-personalizer/widget_rank.php+292
    Function create_function() is deprecated
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_msftcps_rank_widget
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 6× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/azure-cognitive-service-personalizer/features/user_agent.php
    • > /wp-content/plugins/azure-cognitive-service-personalizer/widget_rank.php
    • > /wp-content/plugins/azure-cognitive-service-personalizer/features/post.php
    • > /wp-content/plugins/azure-cognitive-service-personalizer/personalizer.php
    • > /wp-content/plugins/azure-cognitive-service-personalizer/features/geo.php
    • > /wp-content/plugins/azure-cognitive-service-personalizer/cognitive_service_personalizer.php
  • 29× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Test\\AbstractParserTest' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/tests/ParserTest.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\AbstractParser' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/src/Parser.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Test\\Util\\Logfile\\AbstractReaderTest' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/tests/Util/Logfile/ApacheCommonLogFormatReaderTest.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Result\\AbstractClient' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/src/Result/Client.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Result\\AbstractVersionedSoftware' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/src/Result/OperatingSystem.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Util\\Logfile\\AbstractReader' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/src/Util/Logfile/ApacheCommonLogFormatReader.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Test\\AbstractTestCase' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/tests/Result/UserAgentTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Result\\AbstractVersionedSoftware' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/src/Result/UserAgent.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Console\\Command\\Command' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/src/Command/UpdateCommand.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'UAParser\\Result\\AbstractSoftware' not found in wp-content/plugins/azure-cognitive-service-personalizer/vendor/ua-parser/uap-php/src/Result/AbstractVersionedSoftware.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
7 plugin tags: rl, personalization, ai, azure, microsoft...

azure-cognitive-service-personalizer/personalizer.php 92% from 13 tests

The main PHP file in "Azure Cognitive Service Personalizer" ver. 1.0 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("azure-cognitive-service-personalizer.php" instead of "personalizer.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
No dangerous file extensions were detected9,554 lines of code in 68 files:
LanguageFilesBlank linesComment linesLines of code
PHP545247438,869
Markdown41080336
JSON400222
YAML213062
XML27048
Bourne Shell12017
JavaScript1290

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity4.81
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity1.97
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces12
Interfaces1
Traits0
Classes42
▷ Abstract classes819.05%
▷ Concrete classes3480.95%
▷ Final classes00.00%
Methods156
▷ Static methods3421.79%
▷ Public methods11875.64%
▷ Protected methods2214.10%
▷ Private methods1610.26%
Functions16
▷ Named functions1062.50%
▷ Anonymous functions637.50%
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 images were found in this plugin