84% get-country-from-ip

Code Review | Get Country From IP

WordPress plugin Get Country From IP scored84%from 54 tests.

About plugin

  • Plugin page: get-country-from-ip
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8-4.9
  • WordPress version: 6.3.1
  • First release: Dec 10, 2018
  • Latest release: Dec 10, 2018
  • Number of updates: 2
  • Update frequency: every 1.0 days
  • Top authors: asarfraz (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /459 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼8.88ms] Passed 4 tests

An overview of server-side resources used by Get Country From IP
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0239.72 ▼2.26
Dashboard /wp-admin3.32 ▲0.0244.84 ▼11.77
Posts /wp-admin/edit.php3.37 ▲0.0247.98 ▲0.31
Add New Post /wp-admin/post-new.php5.90 ▲0.0284.34 ▼21.78
Media Library /wp-admin/upload.php3.24 ▲0.0239.39 ▲1.65

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 2 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
db_upgraded
widget_theysaidso_widget
widget_recent-posts
widget_asarfraz_gcfip_load_widget
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Get Country From IP
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.20 ▼1.481.78 ▲0.0443.46 ▼4.61
Dashboard /wp-admin2,203 ▲124.85 ▼0.0497.63 ▼23.3442.05 ▼3.85
Posts /wp-admin/edit.php2,086 ▼32.06 ▲0.0234.03 ▼2.9537.74 ▲2.49
Add New Post /wp-admin/post-new.php1,533 ▲1423.37 ▲2.38699.28 ▲36.7558.37 ▼6.51
Media Library /wp-admin/upload.php1,388 ▼34.24 ▼0.00108.66 ▲8.9546.50 ▲2.50

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_asarfraz_gcfip_load_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/get-country-from-ip/get-country-from-ip.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
No tags were detected

get-country-from-ip/get-country-from-ip.php Passed 13 tests

The entry point to "Get Country From IP" version 1.0 is a PHP file that has certain tags in its header comment area
81 characters long description:
This plugin displays the name and flag of the country in a widget on your website

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin58 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1101458

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity4.00
▷ Minimum class complexity4.00
▷ Maximum class complexity4.00
Average method complexity1.75
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG files were detected