10% mhs-travel-map

Code Review | My Hitchhiking Spot Travel Map (MHS Travel Map)

WordPress plugin My Hitchhiking Spot Travel Map (MHS Travel Map) scored 10% from 54 tests.

About plugin

  • Plugin page: mhs-travel-map
  • Plugin version: 1.5.1
  • PHP compatiblity: 5.2.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4.0-5.3.2
  • WordPress version: 6.3.1
  • First release: Nov 20, 2017
  • Latest release: Mar 21, 2020
  • Number of updates: 58
  • Update frequency: every 14.7 days
  • Top authors: daemmi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,341 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
You still need to fix the following installer errors
  • Install procedure had errors
    • > Notice in wp-content/plugins/mhs-travel-map/includes/class-mhs-tm-utilities.php+80
    Trying to access array offset on value of type null

Server metrics [RAM: ▼1.86MB] [CPU: ▼57.98ms] Passed 4 tests

A check of server-side resources used by My Hitchhiking Spot Travel Map (MHS Travel Map)
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.07 ▼1.394.58 ▼39.04
Dashboard /wp-admin2.17 ▼1.136.71 ▼44.89
Posts /wp-admin/edit.php2.17 ▼1.187.89 ▼42.21
Add New Post /wp-admin/post-new.php2.17 ▼3.726.10 ▼105.78
Media Library /wp-admin/upload.php2.18 ▼1.055.95 ▼29.20
Routes /wp-admin/admin.php?page=mhs_tm-routes2.176.61
Maps /wp-admin/admin.php?page=mhs_tm-maps2.176.72
Map edit /wp-admin/admin.php?page=mhs_tm-maps-edit2.176.76
Settings /wp-admin/admin.php?page=mhs_tm-settings2.175.75

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 62 new files
Database: 2 new tables, 7 new options
New tables
wp_mhs_tm_routes
wp_mhs_tm_maps
New WordPress options
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
db_upgraded
MHS_TM_db_version

Browser metrics Passed 4 tests

Checking browser requirements for My Hitchhiking Spot Travel Map (MHS Travel Map)
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,963 ▲20614.48 ▼0.2010.83 ▲8.6442.13 ▼4.65
Dashboard /wp-admin2,261 ▲735.65 ▲0.78111.41 ▲7.8877.95 ▲39.08
Posts /wp-admin/edit.php2,146 ▲572.40 ▲0.4044.50 ▲8.9935.57 ▲2.87
Add New Post /wp-admin/post-new.php1,563 ▲4923.48 ▲5.90675.52 ▲22.1837.78 ▼19.41
Media Library /wp-admin/upload.php1,440 ▲525.01 ▲0.80116.61 ▲16.3444.70 ▲3.11
Routes /wp-admin/admin.php?page=mhs_tm-routes1,1663.7069.1027.99
Maps /wp-admin/admin.php?page=mhs_tm-maps1,0692.4132.5224.38
Map edit /wp-admin/admin.php?page=mhs_tm-maps-edit9682.4228.6927.30
Settings /wp-admin/admin.php?page=mhs_tm-settings1,2733.0953.5126.26

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/mhs-travel-map/includes/class-mhs-tm-utilities.php+80
    Trying to access array offset on value of type null
  • The uninstall procedure failed, leaving 2 tables in the database
    • wp_mhs_tm_maps
    • wp_mhs_tm_routes
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-posts
    • MHS_TM_db_version
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=mhs_tm-settings
    • > Notice in wp-content/plugins/mhs-travel-map/includes/class-mhs-tm-utilities.php+80
    Trying to access array offset on value of type null
    • > GET request to /wp-admin/admin.php?page=mhs_tm-routes
    • > Notice in wp-content/plugins/mhs-travel-map/includes/class-mhs-tm-utilities.php+96
    Undefined index: api_key_gmap

SRP 50% 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
Almost there! Just fix the following items
  • 10× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      require_once(MHS_TM_ABSPATH/admin/tables/class-wp-list-table-my.php): failed to open stream: No such file or directory in wp-content/plugins/mhs-travel-map/admin/tables/list-table-map-routes.php on line 32
    • > PHP Warning
      require_once(MHS_TM_ABSPATH/admin/tables/class-wp-list-table-my.php): failed to open stream: No such file or directory in wp-content/plugins/mhs-travel-map/admin/tables/list-table-routes.php on line 32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/mhs-travel-map/mhs-tm.php:38
    • > PHP Fatal error
      require_once(): Failed opening required 'MHS_TM_ABSPATH/admin/tables/class-wp-list-table-my.php' (include_path='.:/usr/share/php') in wp-content/plugins/mhs-travel-map/admin/tables/list-table-maps.php on line 32
    • > PHP Warning
      Use of undefined constant MHS_TM_ABSPATH - assumed 'MHS_TM_ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/mhs-travel-map/admin/tables/list-table-maps.php on line 32
    • > PHP Warning
      Use of undefined constant MHS_TM_ABSPATH - assumed 'MHS_TM_ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/mhs-travel-map/admin/tables/list-table-routes.php on line 32
    • > PHP Fatal error
      require_once(): Failed opening required 'MHS_TM_ABSPATH/admin/tables/class-wp-list-table-my.php' (include_path='.:/usr/share/php') in wp-content/plugins/mhs-travel-map/admin/tables/list-table-map-routes.php on line 32
    • > PHP Warning
      Use of undefined constant MHS_TM_ABSPATH - assumed 'MHS_TM_ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/mhs-travel-map/admin/tables/list-table-map-routes.php on line 32
    • > PHP Warning
      require_once(MHS_TM_ABSPATH/admin/tables/class-wp-list-table-my.php): failed to open stream: No such file or directory in wp-content/plugins/mhs-travel-map/admin/tables/list-table-maps.php on line 32
    • > PHP Fatal error
      require_once(): Failed opening required 'MHS_TM_ABSPATH/admin/tables/class-wp-list-table-my.php' (include_path='.:/usr/share/php') in wp-content/plugins/mhs-travel-map/admin/tables/list-table-routes.php on line 32

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=mhs_tm-routes
    • > Console-api (warning) in unknown
    https://maps.googleapis.com/maps/api/js?key=AIzaSyAcxQgsVr_SEK2rUape65zv7v6Jn0ElZHc&ver=6.3.1 208:51 "Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading"

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
7 plugin tags: travel, google maps, hitchhike, hitchhiking, backpacking...

mhs-travel-map/mhs-tm.php 85% from 13 tests

The main file in "My Hitchhiking Spot Travel Map (MHS Travel Map)" v. 1.5.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("mhs-travel-map.php" instead of "mhs-tm.php")
  • Description: Please keep the plugin description shorter than 140 characters (currently 347 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected21,044 lines of code in 44 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript133,1132,46812,875
PHP169001,8624,344
CSS131781673,304
HTML19616447
JSON10074

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
These items need your attention
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 130)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity40.87
▷ Minimum class complexity1.00
▷ Maximum class complexity155.00
Average method complexity5.12
▷ Minimum method complexity1.00
▷ Maximum method complexity130.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes15
▷ Abstract classes00.00%
▷ Concrete classes15100.00%
▷ Final classes00.00%
Methods145
▷ Static methods10.69%
▷ Public methods11075.86%
▷ Protected methods2114.48%
▷ Private methods149.66%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
12 PNG files occupy 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/mhs-tm-close-button-white.png6.13KB2.79KB▼ 54.42%
css/jquery-ui/images/ui-icons_555555_256x240.png6.91KB4.18KB▼ 39.47%
css/jquery-ui/images/ui-icons_444444_256x240.png6.84KB4.18KB▼ 38.90%
img/Pin-Star.png2.06KB1.17KB▼ 43.21%
css/jquery-ui/images/ui-icons_ffffff_256x240.png6.17KB4.18KB▼ 32.17%