84% locale-auto-switch

Code Review | Locale Auto Switch

WordPress plugin Locale Auto Switch scored84%from 54 tests.

About plugin

  • Plugin page: locale-auto-switch
  • Plugin version: 1.16
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.4
  • WordPress version: 6.3.1
  • First release: Jun 29, 2018
  • Latest release: Oct 29, 2023
  • Number of updates: 45
  • Update frequency: every 43.3 days
  • Top authors: Katsushi Kawamori (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /2,044 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.23MB] [CPU: ▼8.35ms] Passed 4 tests

An overview of server-side resources used by Locale Auto Switch
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.73 ▲0.2634.91 ▼5.09
Dashboard /wp-admin3.54 ▲0.2046.19 ▼14.76
Posts /wp-admin/edit.php3.59 ▲0.2446.99 ▼1.50
Add New Post /wp-admin/post-new.php6.13 ▲0.2479.59 ▼12.04
Media Library /wp-admin/upload.php3.46 ▲0.2433.82 ▼0.18
Locale Auto Switch /wp-admin/options-general.php?page=LocaleAutoSwitch3.5832.70

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-comments
widget_localeautoswitchwidgetitem
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
locale_auto_switch
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Locale Auto Switch
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲4714.35 ▼0.301.61 ▲0.0337.75 ▲0.01
Dashboard /wp-admin2,196 ▲195.63 ▼0.0481.23 ▼5.5340.17 ▲1.73
Posts /wp-admin/edit.php2,104 ▲42.02 ▼0.0138.92 ▲2.7633.99 ▼0.77
Add New Post /wp-admin/post-new.php6,195 ▲4,66619.05 ▼3.88910.78 ▲286.0676.86 ▲24.93
Media Library /wp-admin/upload.php1,407 ▲74.21 ▼0.0994.57 ▼0.0140.41 ▼1.44
Locale Auto Switch /wp-admin/options-general.php?page=LocaleAutoSwitch5,3991.2026.68119.99

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • db_upgraded
    • widget_localeautoswitchwidgetitem
    • theysaidso_admin_options
    • 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
Even though everything seems fine, this is not 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
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_upload_dir() in wp-content/plugins/locale-auto-switch/lib/class-localeautoswitchadmin.php:62
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/locale-auto-switch/lib/class-localeautoswitchregist.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_available_languages() in wp-content/plugins/locale-auto-switch/lib/class-localeautoswitch.php:53
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/locale-auto-switch/lib/class-localeautoswitchwidgetitem.php:23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/locale-auto-switch/lib/class-localeautoswitchregist.php:37

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
3 plugin tags: locale, languages, browser

locale-auto-switch/localeautoswitch.php 92% from 13 tests

The primary PHP file in "Locale Auto Switch" version 1.16 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("locale-auto-switch.php" instead of "localeautoswitch.php")

Code Analysis Passed 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
Success! There were no dangerous files found in this plugin617 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP783253576
JavaScript24021
JSON10020

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity22.50
▷ Minimum class complexity1.00
▷ Maximum class complexity73.00
Average method complexity6.06
▷ Minimum method complexity1.00
▷ Maximum method complexity35.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods17
▷ Static methods00.00%
▷ Public methods1270.59%
▷ Protected methods00.00%
▷ Private methods529.41%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants0
▷ Global constants00.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
No PNG files were detected