72% carto

Code Review | Carto: Maps for WordPress

WordPress plugin Carto: Maps for WordPress scored72%from 54 tests.

About plugin

  • Plugin page: carto
  • Plugin version: 1.0.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0.0-5.5
  • WordPress version: 6.3.1
  • First release: Aug 2, 2019
  • Latest release: Sep 4, 2020
  • Number of updates: 12
  • Update frequency: every 33.3 days
  • Top authors: evolvesnc (75%)andg (33.33%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,299 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
Install script ran successfully

Server metrics [RAM: ▲0.31MB] [CPU: ▼7.70ms] Passed 4 tests

Server-side resources used by Carto: Maps for WordPress
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.81 ▲0.3549.42 ▲4.60
Dashboard /wp-admin3.63 ▲0.3354.53 ▼1.71
Posts /wp-admin/edit.php3.69 ▲0.3347.89 ▼10.44
Add New Post /wp-admin/post-new.php6.18 ▲0.2998.21 ▼21.59
Media Library /wp-admin/upload.php3.51 ▲0.2843.03 ▲2.94
Carto /wp-admin/options-general.php?page=carto3.4840.65

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 66 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
widget_carto_map
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Carto: Maps for WordPress
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,970 ▲18415.60 ▲1.0124.80 ▲22.7340.32 ▼7.28
Dashboard /wp-admin2,262 ▲856.03 ▲0.36119.45 ▲21.9941.63 ▼2.59
Posts /wp-admin/edit.php2,173 ▲733.25 ▲1.2949.26 ▲12.0660.43 ▲23.37
Add New Post /wp-admin/post-new.php6,243 ▲4,71519.98 ▼3.14856.56 ▲171.7534.97 ▼18.40
Media Library /wp-admin/upload.php1,467 ▲645.59 ▲1.29116.95 ▲8.7742.69 ▼9.66
Carto /wp-admin/options-general.php?page=carto9053.1240.6629.45

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_carto_map
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
  • 15× PHP files perform the task of outputting text when accessed with GET requests (only 10 are shown):
    • > /wp-content/plugins/carto/src/Core.php
    • > /wp-content/plugins/carto/src/Core/Utils/Filter.php
    • > /wp-content/plugins/carto/config.php
    • > /wp-content/plugins/carto/src/Core/Utils/Asset.php
    • > /wp-content/plugins/carto/src/Core/Settings.php
    • > /wp-content/plugins/carto/src/Core/Utils/Logger.php
    • > /wp-content/plugins/carto/src/Core/Utils/Notice.php
    • > /wp-content/plugins/carto/src/Adapters/Widget.php
    • > /wp-content/plugins/carto/carto.php
    • > /wp-content/plugins/carto/src/Adapters/BlockAdapter.php
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/carto/templates/admin.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/carto/templates/settings.php:8

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
    • > GET request to /wp-admin/options-general.php?page=carto
    • > Console-api (warning) in unknown
    https://maps.googleapis.com/maps/api/js?key=&libraries=places 235:51 "Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading"

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
6 plugin tags: gutenberg blocks, blocks, block-editor, gutenberg, googlemaps...

carto/carto.php 92% from 13 tests

"Carto: Maps for WordPress" version 1.0.4's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • Domain Path: The domain path points to a folder that does not exist ("/languages/")

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
Everything looks great! No dangerous files found in this plugin1,599 lines of code in 55 files:
LanguageFilesBlank linesComment linesLines of code
PHP244518691,554
JavaScript73521
SVG180018
CSS5005
JSON1001

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity11.25
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.75
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces5
Interfaces0
Traits0
Classes16
▷ Abstract classes00.00%
▷ Concrete classes16100.00%
▷ Final classes00.00%
Methods95
▷ Static methods3031.58%
▷ Public methods8791.58%
▷ Protected methods00.00%
▷ Private methods88.42%
Functions7
▷ Named functions228.57%
▷ Anonymous functions571.43%
Constants6
▷ Global constants6100.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
8 PNG files occupy 0.07MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/css/images/marker-icon.png1.43KB1.55KB0.00%
assets/css/images/marker-shadow.png0.60KB1.16KB0.00%
assets/css/images/marker-icon-2x.png2.41KB2.52KB0.00%
assets/css/images/marker-alt.png1.70KB1.12KB▼ 34.33%
assets/css/images/marker-alt-retina.png4.07KB2.12KB▼ 47.86%