83% acf-city-selector

Code Review | ACF City Selector

WordPress plugin ACF City Selector scored 83% from 54 tests.

About plugin

  • Plugin page: acf-city-selector
  • Plugin version: 1.6.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6.0-5.9.2
  • WordPress version: 5.9.2
  • First release: Dec 25, 2020
  • Latest release: Mar 20, 2022
  • Number of updates: 24
  • Update frequency: every 18.8 days
  • Top authors: Beee (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active / 1,863 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▲0.46MB] [CPU: ▼289.20ms] 75% from 4 tests

This is a short check of server-side resources used by ACF City Selector
Please have a look at the following items
  • CPU: Total CPU usage should be kept under 500.00ms (currently 2,829.21ms on /wp-admin/admin.php?page=acfcs-countries)
PageMemory (MB)CPU Time (ms)
Home /4.05 ▲0.5362.47 ▲4.29
Dashboard /wp-admin3.90 ▲0.4939.88 ▲2.12
Posts /wp-admin/edit.php4.13 ▲0.4855.41 ▲13.54
Add New Post /wp-admin/post-new.php7.37 ▲0.40103.17 ▼1,157.59
Media Library /wp-admin/upload.php3.79 ▲0.4829.51 ▼5.62
Info /wp-admin/admin.php?page=acfcs-info3.7735.88
Preview data /wp-admin/admin.php?page=acfcs-preview3.7628.01
City Selector /wp-admin/options-general.php?page=acfcs-dashboard3.7730.79
Settings /wp-admin/admin.php?page=acfcs-settings3.7629.95
Get countries /wp-admin/admin.php?page=acfcs-countries3.922,829.21
Search /wp-admin/admin.php?page=acfcs-search3.7631.76

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 45 new files
Database: 1 new table, 1 new option
New tables
wp_cities
New WordPress options
acfcs_db_version

Browser metrics Passed 4 tests

A check of browser resources used by ACF City Selector
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,824 ▲7015.72 ▲0.045.74 ▼2.522.94 ▲0.35
Dashboard /wp-admin2,919 ▲656.18 ▲0.01121.04 ▼15.16153.79 ▼13.77
Posts /wp-admin/edit.php2,713 ▲223.36 ▲0.0167.77 ▲3.42141.97 ▼2.40
Add New Post /wp-admin/post-new.php1,679 ▲1816.22 ▲0.06416.45 ▼7.87162.83 ▲11.80
Media Library /wp-admin/upload.php1,726 ▲255.57 ▲0.03144.70 ▲2.98189.25 ▲0.42
Info /wp-admin/admin.php?page=acfcs-info1,9082.5454.56147.95
Preview data /wp-admin/admin.php?page=acfcs-preview1,5592.7654.82127.33
City Selector /wp-admin/options-general.php?page=acfcs-dashboard1,6522.7552.98151.12
Settings /wp-admin/admin.php?page=acfcs-settings1,7032.8254.43132.38
Get countries /wp-admin/admin.php?page=acfcs-countries2,6342.8755.06155.31
Search /wp-admin/admin.php?page=acfcs-search1,5602.8153.31128.18

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie tables were found after uninstall: 1 table
    • wp_cities

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
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
Please take a closer look at the following
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/form-handling.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/acfcs-ajax.php:59
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/acfcs-actions.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/acf-city-selector/inc/acfcs-help-tabs.php:110

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed: You can take inspiration from this readme.txt

acf-city-selector/ACF_City_Selector.php 92% from 13 tests

"ACF City Selector" version 1.6.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
You should first fix the following items:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("acf-city-selector.php" instead of "ACF_City_Selector.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin5,320 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
PHP245537343,342
PO File26008951,306
CSS29216390
JavaScript44841282

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity91.00
▷ Minimum class complexity35.00
▷ Maximum class complexity111.00
Average method complexity11.60
▷ Minimum method complexity1.00
▷ Maximum method complexity51.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods44
▷ Static methods511.36%
▷ Public methods44100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions45
▷ Named functions4395.56%
▷ Anonymous functions24.44%
Constants2
▷ Global constants2100.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
5 PNG files occupy 0.30MB with 0.17MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-128x128.png6.71KB3.13KB▼ 53.32%
assets/screenshot-1.png210.79KB53.60KB▼ 74.57%
assets/banner-772x250.png28.64KB11.03KB▼ 61.48%
assets/icon-256x256.png8.01KB4.29KB▼ 46.40%
assets/banner-1544x500.png48.14KB19.37KB▼ 59.76%