58% mycityselector

Code Review | MyCitySelector

WordPress plugin MyCitySelector scored58%from 54 tests.

About plugin

  • Plugin page: mycityselector
  • Plugin version: 0.0.5
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8-5.9
  • WordPress version: 6.3.1
  • First release: Sep 19, 2021
  • Latest release: Feb 1, 2022
  • Number of updates: 36
  • Update frequency: every 3.8 days
  • Top authors: vladsmolensky (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,169 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.38MB] [CPU: ▲0.24ms] Passed 4 tests

A check of server-side resources used by MyCitySelector
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.15 ▲0.4245.88 ▲1.84
Dashboard /wp-admin3.95 ▲0.3955.69 ▼0.13
Posts /wp-admin/edit.php4.00 ▲0.3256.93 ▲2.79
Add New Post /wp-admin/post-new.php6.93 ▲0.7895.14 ▼3.53
Media Library /wp-admin/upload.php3.88 ▲0.3946.39 ▲7.55

Server storage [IO: ▲16.03MB] [DB: ▲0.01MB] Passed 3 tests

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 868 new files
Database: 9 new tables, 7 new options
New tables
mcs_phinxlog
mcs_provinces
mcs_country_field_values
mcs_field_values
mcs_city_field_values
mcs_countries
mcs_cities
mcs_province_field_values
mcs_fields
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_mcs_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

MyCitySelector: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,027 ▲26620.01 ▲5.8713.67 ▲11.5255.70 ▲8.89
Dashboard /wp-admin2,333 ▲1598.01 ▲2.33162.36 ▲63.6796.14 ▲50.15
Posts /wp-admin/edit.php2,240 ▲1585.37 ▲3.3456.94 ▲20.4035.30 ▼1.73
Add New Post /wp-admin/post-new.php1,644 ▲11323.97 ▲0.65712.81 ▲10.9938.03 ▼13.33
Media Library /wp-admin/upload.php1,530 ▲1277.40 ▲3.16117.82 ▲8.6082.83 ▲36.33

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • The plugin did not uninstall successfully, leaving 9 tables in the database
    • mcs_fields
    • mcs_provinces
    • mcs_cities
    • mcs_field_values
    • mcs_countries
    • mcs_phinxlog
    • mcs_city_field_values
    • mcs_country_field_values
    • mcs_province_field_values
  • The uninstall procedure has failed, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_mcs_widget
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/mycityselector/tests/bootstrap.php
  • 367× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Mcs\\WpModels\\BaseModel' not found in wp-content/plugins/mycityselector/src/WpModels/ProvinceNames.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Cake\\Core\\ObjectRegistry' not found in wp-content/plugins/mycityselector/vendor/cakephp/datasource/ConnectionRegistry.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Model\\Country' not found in wp-content/plugins/mycityselector/vendor/geoip2/geoip2/src/Model/City.php:32
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Console\\Command\\Command' not found in wp-content/plugins/mycityselector/vendor/symfony/console/Command/HelpCommand.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Console\\Output\\StreamOutput' not found in wp-content/plugins/mycityselector/vendor/symfony/console/Output/ConsoleOutput.php:30
    • > PHP Fatal error
      Uncaught Error: Interface 'Phinx\\Migration\\MigrationInterface' not found in wp-content/plugins/mycityselector/vendor/robmorgan/phinx/src/Phinx/Migration/AbstractMigration.php:26
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Filesystem\\Exception\\ExceptionInterface' not found in wp-content/plugins/mycityselector/vendor/symfony/filesystem/Exception/InvalidArgumentException.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Phinx\\Db\\Adapter\\PdoAdapter' not found in wp-content/plugins/mycityselector/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Config\\Definition\\Exception\\Exception' not found in wp-content/plugins/mycityselector/vendor/symfony/config/Definition/Exception/UnsetKeyException.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Console\\Event\\ConsoleEvent' not found in wp-content/plugins/mycityselector/vendor/symfony/console/Event/ConsoleErrorEvent.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 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
These attributes need your attention:
  • Screenshots: Please add an image for screenshot #1 (Plugin admin interface)
Please take inspiration from this readme.txt

mycityselector/mcs.php 85% from 13 tests

This is the main PHP file of "MyCitySelector" version 0.0.5, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("mycityselector.php" instead of "mcs.php")
  • Text Domain: Please use dashes and lowercase characters for text domains

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
These items require your attention
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/mycityselector/vendor/robmorgan/phinx/bin/phinx.bat
78,318 lines of code in 802 files:
LanguageFilesBlank linesComment linesLines of code
PHP64313,21635,93365,659
reStructuredText252,0942,2603,687
JSON34003,079
TypeScript22135632,100
Markdown3583902,092
C111825668
YAML102728229
Bourne Shell54213200
SVG200173
JavaScript91611129
XML3812108
JSX15068
m418032
Python5252331
DOS Batch112623
HTML132020
Dockerfile10012
C/C++ Header14128
CSS26540

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity13.76
▷ Minimum class complexity1.00
▷ Maximum class complexity228.00
Average method complexity2.79
▷ Minimum method complexity1.00
▷ Maximum method complexity62.00
Code structure
Namespaces103
Interfaces106
Traits26
Classes457
▷ Abstract classes347.44%
▷ Concrete classes42392.56%
▷ Final classes255.91%
Methods4,522
▷ Static methods4129.11%
▷ Public methods3,70581.93%
▷ Protected methods59713.20%
▷ Private methods2204.87%
Functions309
▷ Named functions11637.54%
▷ Anonymous functions19362.46%
Constants355
▷ Global constants123.38%
▷ Class constants34396.62%
▷ Public constants27981.34%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
4 PNG files occupy 0.12MB with 0.03MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/banner-772x250.png44.03KB16.83KB▼ 61.77%
assets/screenshot-1.png61.12KB29.07KB▼ 52.44%
admin/public/logo192.png5.22KB5.57KB0.00%
admin/public/logo512.png9.44KB10.35KB0.00%