84% geolocator

Code Review | Geolocator

WordPress plugin Geolocator scored84%from 54 tests.

About plugin

  • Plugin page: geolocator
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1.1-4.9
  • WordPress version: 6.3.1
  • First release: Mar 26, 2015
  • Latest release: Nov 27, 2017
  • Number of updates: 25
  • Update frequency: every 54.2 days
  • Top authors: masikonis (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

50+ active /3,126 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.28MB] [CPU: ▼7.59ms] Passed 4 tests

A check of server-side resources used by Geolocator
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.78 ▲0.3143.43 ▲6.26
Dashboard /wp-admin3.63 ▲0.2849.84 ▼13.50
Posts /wp-admin/edit.php3.68 ▲0.3244.04 ▼4.23
Add New Post /wp-admin/post-new.php6.15 ▲0.2681.65 ▼11.56
Media Library /wp-admin/upload.php3.49 ▲0.2637.61 ▼1.06
Geolocator /wp-admin/options-general.php?page=geolocator_options3.4529.09

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 97 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
geolocator_options
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
db_upgraded
widget_geolocator_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Geolocator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.73 ▲0.761.72 ▲0.1246.07 ▲5.06
Dashboard /wp-admin2,199 ▲215.63 ▼0.1185.15 ▼26.1435.85 ▼3.24
Posts /wp-admin/edit.php2,104 ▲42.03 ▲0.0134.89 ▼1.9635.36 ▲2.69
Add New Post /wp-admin/post-new.php6,267 ▲4,74121.05 ▼2.08883.02 ▲262.8694.36 ▲21.73
Media Library /wp-admin/upload.php1,404 ▲104.19 ▲0.0094.83 ▼10.0840.39 ▼5.69
Geolocator /wp-admin/options-general.php?page=geolocator_options7972.0023.6224.40

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_geolocator_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
Please fix the following items
  • 39× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\HttpException' not found in wp-content/plugins/geolocator/vendor/geoip2/geoip2/src/Exception/InvalidRequestException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/geolocator/vendor/geoip2/geoip2/src/Exception/AuthenticationException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geolocator/vendor/maxmind/web-service-common/src/Exception/PermissionRequiredException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geolocator/vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geolocator/vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Exception\\GeoIp2Exception' not found in wp-content/plugins/geolocator/vendor/geoip2/geoip2/src/Exception/HttpException.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'MaxMind\\Exception\\InvalidRequestException' not found in wp-content/plugins/geolocator/vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geolocator/vendor/geoip2/geoip2/src/Record/Location.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractPlaceRecord' not found in wp-content/plugins/geolocator/vendor/geoip2/geoip2/src/Record/Continent.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'GeoIp2\\Record\\AbstractRecord' not found in wp-content/plugins/geolocator/vendor/geoip2/geoip2/src/Record/MaxMind.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
6 plugin tags: user country, geolocator, ip based location, hide for country, show for country...

geolocator/geolocator.php 92% from 13 tests

The main file in "Geolocator" v. 1.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 159 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
There were no executable files found in this plugin4,220 lines of code in 83 files:
LanguageFilesBlank linesComment linesLines of code
PHP667111,8072,604
Markdown83420743
C17315477
JSON600374
m415014
C/C++ Header14128

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity5.92
▷ Minimum class complexity1.00
▷ Maximum class complexity47.00
Average method complexity2.68
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces14
Interfaces4
Traits0
Classes55
▷ Abstract classes35.45%
▷ Concrete classes5294.55%
▷ Final classes00.00%
Methods168
▷ Static methods95.36%
▷ Public methods12071.43%
▷ Protected methods10.60%
▷ Private methods4727.98%
Functions19
▷ Named functions1473.68%
▷ Anonymous functions526.32%
Constants3
▷ Global constants133.33%
▷ Class constants266.67%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
PNG images were not found in this plugin