78% civic-geo

Code Review | Civic Lookup

WordPress plugin Civic Lookup scored78%from 54 tests.

About plugin

  • Plugin page: civic-geo
  • Plugin version: 1.2
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.7
  • WordPress version: 6.3.1
  • First release: May 27, 2021
  • Latest release: May 27, 2021
  • Number of updates: 5
  • Update frequency: every 0.2 days
  • Top authors: jonahwhale (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /367 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼4.69ms] Passed 4 tests

A check of server-side resources used by Civic Lookup
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0240.96 ▲0.64
Dashboard /wp-admin3.33 ▲0.0351.78 ▼4.04
Posts /wp-admin/edit.php3.45 ▲0.0954.15 ▲0.55
Add New Post /wp-admin/post-new.php5.92 ▲0.0392.23 ▼15.90
Media Library /wp-admin/upload.php3.26 ▲0.0340.56 ▲3.52
Civic Lookup /wp-admin/options-general.php?page=mt-cglu3.2234.45

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

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

Browser metrics Passed 4 tests

Civic Lookup: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,875 ▲11413.48 ▼0.928.40 ▲6.6943.68 ▲0.59
Dashboard /wp-admin2,196 ▲195.54 ▲0.0183.46 ▼13.1737.79 ▼9.26
Posts /wp-admin/edit.php2,107 ▲72.02 ▲0.0135.85 ▼1.1636.88 ▲0.11
Add New Post /wp-admin/post-new.php1,544 ▲522.62 ▼0.39653.35 ▼5.3954.49 ▼8.91
Media Library /wp-admin/upload.php1,404 ▲74.14 ▼0.05113.50 ▲12.6446.57 ▼0.90
Civic Lookup /wp-admin/options-general.php?page=mt-cglu1,0582.0025.1029.28

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
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/civic-geo/src/blocks/legislators_start.php
  • 9× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/civic-geo/src/shortcodes.php:8
    • > PHP Notice
      Undefined variable: lookup in wp-content/plugins/civic-geo/src/blocks/lookup.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/civic-geo/src/install.php:5
    • > PHP Fatal error
      Uncaught Error: Call to a member function getRedirect() on null in wp-content/plugins/civic-geo/src/blocks/lookup.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'CivicLookup\\PodTable' not found in wp-content/plugins/civic-geo/src/classes/Person.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/civic-geo/src/admin.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CLI_Command' not found in wp-content/plugins/civic-geo/src/commands.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'CivicLookup\\PodTable' not found in wp-content/plugins/civic-geo/src/classes/PodRecord.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/civic-geo/src/enqueue.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
1 plugin tags: congress

civic-geo/civic-lookup.php 92% from 13 tests

The primary PHP file in "Civic Lookup" version 1.2 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("civic-geo.php" instead of "civic-lookup.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin2,015 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP153135471,705
JSON100297
CSS14013

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity29.67
▷ Minimum class complexity1.00
▷ Maximum class complexity107.00
Average method complexity2.81
▷ Minimum method complexity1.00
▷ Maximum method complexity48.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods95
▷ Static methods00.00%
▷ Public methods95100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.54MB with 0.41MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/ScreenShotCivicLookup.png276.33KB64.94KB▼ 76.50%
ScreenShotCivicLookup.png276.33KB64.94KB▼ 76.50%