56% simple-locator

Code Review | Simple Locator

WordPress plugin Simple Locator scored56%from 54 tests.

About plugin

  • Plugin page: simple-locator
  • Plugin version: 2.0.3
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.1
  • WordPress version: 6.3.1
  • First release: Jan 2, 2015
  • Latest release: Oct 31, 2022
  • Number of updates: 124
  • Update frequency: every 23.1 days
  • Top authors: kylephillips (100%)

Code review

54 tests

User reviews

16 reviews

Install metrics

800+ active /23,271 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲1.13MB] [CPU: ▲7.03ms] Passed 4 tests

Analyzing server-side resources used by Simple Locator
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.56 ▲1.0952.87 ▲15.52
Dashboard /wp-admin4.44 ▲1.1360.87 ▲9.14
Posts /wp-admin/edit.php4.50 ▲1.1461.86 ▲15.21
Add New Post /wp-admin/post-new.php7.09 ▲1.21102.91 ▼5.36
Media Library /wp-admin/upload.php4.36 ▲1.1345.13 ▲9.14
Simple Locator /wp-admin/options-general.php?page=wp_simple_locator4.4348.17
Locations /wp-admin/edit.php?post_type=location4.4754.43
Add New /wp-admin/post-new.php?post_type=location7.0492.13

Server storage [IO: ▲3.11MB] [DB: ▲0.02MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 467 new files
Database: 1 new table, 27 new options
New tables
wp_simple_locator_history
New WordPress options
wpsl_output_css
wpsl_version
wpsl_measurement_unit
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts
wpsl_posttype_labels
wpsl_default_map
wpsl_geo_button
widget_recent-posts
...

Browser metrics Passed 4 tests

A check of browser resources used by Simple Locator
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,827 ▲4114.28 ▼0.321.73 ▼0.2543.86 ▼1.02
Dashboard /wp-admin2,225 ▲485.52 ▼0.1385.46 ▼8.6039.14 ▼2.22
Posts /wp-admin/edit.php2,133 ▲332.03 ▲0.0739.06 ▼0.1234.55 ▼5.58
Add New Post /wp-admin/post-new.php1,554 ▲2823.18 ▲0.12674.75 ▼0.3158.64 ▲0.47
Media Library /wp-admin/upload.php1,433 ▲334.27 ▲0.0897.69 ▼12.1544.91 ▼3.35
Simple Locator /wp-admin/options-general.php?page=wp_simple_locator1,5314.1484.0028.40
Locations /wp-admin/edit.php?post_type=location1,3354.4295.5629.15
Add New /wp-admin/post-new.php?post_type=location6,29919.78929.4843.15

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie tables were found after uninstall: 1 table
    • wp_simple_locator_history
  • This plugin does not fully uninstall, leaving 27 options in the database
    • wpsl_singular_data
    • wpsl_post_type
    • wpsl_gmaps_api_admin
    • wpsl_map_styles_type
    • wpsl_lng_field
    • wpsl_field_type
    • wpsl_map_styles_choice
    • wpsl_lat_field
    • widget_theysaidso_widget
    • can_compress_scripts
    • ...

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
Smoke test failed, please fix the following
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=location
    • > Notice in wp-content/plugins/simple-locator/app/Listeners/GetMetaFieldsForPostType.php+46
    Undefined index: post_type

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
Almost there! Just fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/simple-locator/app/Migrations/map_options/cluster-renderer.php
  • 124× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'SimpleLocator\\Services\\Import\\Listeners\\ImportListenerBase' not found in wp-content/plugins/simple-locator/app/Services/Import/Listeners/FileUploader.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/simple-locator/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\RequestException' not found in wp-content/plugins/simple-locator/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/simple-locator/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\Test\\TestCase' not found in wp-content/plugins/simple-locator/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/simple-locator/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/simple-locator/vendor/guzzlehttp/psr7/src/AppendStream.php:14
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/simple-locator/views/settings/import-1.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/simple-locator/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/simple-locator/views/settings/import-2.php:2

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please take a look at the following user-side issues
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=location
    • > Console-api (warning) in unknown
    https://maps.google.com/maps/api/js?libraries=places&ver=6.3.1 235: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 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
7 plugin tags: store map, locations, store locator, google maps, locator...

simple-locator/simplelocator.php 77% from 13 tests

"Simple Locator" version 2.0.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 157 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("simple-locator.php" instead of "simplelocator.php")
  • Git Repository: A Git repository was detected inside this plugin

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin47,983 lines of code in 405 files:
LanguageFilesBlank linesComment linesLines of code
PHP2923,6449,22236,450
Markdown171,31503,869
JavaScript394116023,301
Sass271111011,657
JSON12001,330
PO File44905261,217
YAML625399
SVG40125
XML12023
Dockerfile18010
CSS2002

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
It is recommended to fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity12.10
▷ Minimum class complexity1.00
▷ Maximum class complexity179.00
Average method complexity3.01
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces45
Interfaces16
Traits7
Classes206
▷ Abstract classes94.37%
▷ Concrete classes19795.63%
▷ Final classes2412.18%
Methods1,306
▷ Static methods17013.02%
▷ Public methods95573.12%
▷ Protected methods574.36%
▷ Private methods29422.51%
Functions183
▷ Named functions7641.53%
▷ Anonymous functions10758.47%
Constants201
▷ Global constants7838.81%
▷ Class constants12361.19%
▷ Public constants123100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
18 PNG files occupy 1.01MB with 0.28MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/datepicker-arrow-prev.png1.05KB0.21KB▼ 79.98%
assets/screenshot-3.png73.62KB72.23KB▼ 1.88%
assets/icon-128x128.png6.38KB3.11KB▼ 51.22%
assets/banner-772x250.png22.09KB21.83KB▼ 1.20%
assets/screenshot-1.png3.81KB3.76KB▼ 1.41%