77% treweler-map-builder

Code Review | Treweler Map Builder

WordPress plugin Treweler Map Builder scored77%from 54 tests.

About plugin

  • Plugin page: treweler-map-builder
  • Plugin version: 1.02
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.7-6.3
  • WordPress version: 6.3.1
  • First release: Oct 28, 2022
  • Latest release: Oct 26, 2023
  • Number of updates: 15
  • Update frequency: every 24.3 days
  • Top authors: aisconverse (66.67%)treweler (40%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active /933 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
Installer ran successfully

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

Analyzing server-side resources used by Treweler Map Builder
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.72 ▲0.2638.70 ▲2.34
Dashboard /wp-admin3.56 ▲0.2645.95 ▼1.69
Posts /wp-admin/edit.php3.62 ▲0.2749.03 ▲1.19
Add New Post /wp-admin/post-new.php6.12 ▲0.2390.59 ▲2.45
Media Library /wp-admin/upload.php3.41 ▲0.1835.68 ▲0.23

Server storage [IO: ▲35.63MB] [DB: ▲0.08MB] 67% from 3 tests

Filesystem and database footprint
Please try to fix the following items
  • Total filesystem usage must be limited to 25MB (currently using 35.63MB)
Filesystem: 1,558 new files
Database: no new tables, 9 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
current_theme_supports_treweler
widget_recent-comments
theysaidso_admin_options
treweler_queue_flush_rewrite_rules
treweler_version
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Treweler Map Builder
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,883 ▲12214.36 ▼0.201.69 ▲0.0639.99 ▼0.52
Dashboard /wp-admin2,278 ▲1015.62 ▲0.0091.93 ▲2.3640.68 ▲2.18
Posts /wp-admin/edit.php2,187 ▲872.01 ▲0.0438.72 ▲2.1936.69 ▼1.63
Add New Post /wp-admin/post-new.php1,580 ▲5423.46 ▲0.27678.42 ▼1.8153.63 ▼2.09
Media Library /wp-admin/upload.php1,487 ▲874.21 ▲0.0394.64 ▼2.1141.37 ▼4.37

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • The uninstall procedure has failed, leaving 9 options in the database
    • treweler_queue_flush_rewrite_rules
    • widget_recent-posts
    • widget_theysaidso_widget
    • treweler_version
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • current_theme_supports_treweler
    • theysaidso_admin_options

Smoke tests 50% 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 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 17× PHP files perform the task of outputting text when accessed with GET requests (only 10 are shown):
    • > /wp-content/plugins/treweler-map-builder/templates/custom-fields/elements/html.php
    • > /wp-content/plugins/treweler-map-builder/templates/custom-fields/elements/separator.php
    • > /wp-content/plugins/treweler-map-builder/libs/smarty/smarty/demo/index.php
    • > /wp-content/plugins/treweler-map-builder/templates/custom-fields/elements/link-universal.php
    • > /wp-content/plugins/treweler-map-builder/templates/custom-fields/elements/line.php
    • > /wp-content/plugins/treweler-map-builder/templates/filters/true-false.php
    • > /wp-content/plugins/treweler-map-builder/templates/custom-fields/elements/category.php
    • > /wp-content/plugins/treweler-map-builder/templates/custom-fields/elements/number.php
    • > /wp-content/plugins/treweler-map-builder/templates/filters/multiselect.php
    • > /wp-content/plugins/treweler-map-builder/templates/custom-fields/elements/multiselect.php
  • 750× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\CssSelector\\Parser\\ParserInterface' not found in wp-content/plugins/treweler-map-builder/libs/symfony/css-selector/Parser/Shortcut/ClassParser.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Collection' not found in wp-content/plugins/treweler-map-builder/libs/google/apiclient-services/src/Sheets/BatchUpdateValuesRequest.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Model' not found in wp-content/plugins/treweler-map-builder/libs/google/apiclient-services/src/Sheets/LineStyle.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Model' not found in wp-content/plugins/treweler-map-builder/libs/google/apiclient-services/src/Sheets/DataSourceParameter.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'phpseclib3\\Crypt\\Common\\AsymmetricKey' not found in wp-content/plugins/treweler-map-builder/libs/phpseclib/phpseclib/phpseclib/Crypt/RSA.php:69
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Model' not found in wp-content/plugins/treweler-map-builder/libs/google/apiclient-services/src/Sheets/GradientRule.php:20
    • > PHP Notice
      Undefined variable: _smarty_tpl in wp-content/plugins/treweler-map-builder/includes/admin/views/templates_c/ecd5a3c3be1944a633f491c82385d718a9f77e57_0.file.goto-pro-message.tpl.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'Smarty_Internal_CompileBase' not found in wp-content/plugins/treweler-map-builder/libs/smarty/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/treweler-map-builder/libs/guzzlehttp/guzzle/src/Exception/ClientException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Google\\Model' not found in wp-content/plugins/treweler-map-builder/libs/google/apiclient-services/src/Sheets/PivotValue.php:20

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 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
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
You can take inspiration from this readme.txt

treweler-map-builder/treweler-free.php 85% from 13 tests

The main PHP file in "Treweler Map Builder" ver. 1.02 adds more information about the plugin and also serves as the entry point for this plugin
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("treweler-map-builder.php" instead of "treweler-free.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin290,164 lines of code in 1,443 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,30719,09767,254116,976
CSS141,09528283,935
JavaScript3615,13313,91975,243
Markdown443,09908,724
JSON26002,917
yacc2253382991
PO File1353562753
Smarty71013533
Bourne Shell38353
SVG20020
XML10019

PHP code 50% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
The following items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 123)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity11.42
▷ Minimum class complexity1.00
▷ Maximum class complexity679.00
Average method complexity2.77
▷ Minimum method complexity1.00
▷ Maximum method complexity123.00
Code structure
Namespaces95
Interfaces57
Traits15
Classes1,131
▷ Abstract classes23620.87%
▷ Concrete classes89579.13%
▷ Final classes758.38%
Methods6,810
▷ Static methods90713.32%
▷ Public methods5,72284.02%
▷ Protected methods5067.43%
▷ Private methods5828.55%
Functions518
▷ Named functions35869.11%
▷ Anonymous functions16030.89%
Constants730
▷ Global constants435.89%
▷ Class constants68794.11%
▷ Public constants63892.87%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/marker-ring.png21.80KB9.45KB▼ 56.65%