78% companion-sitemap-generator

Code Review | Companion Sitemap Generator - HTML & XML

WordPress plugin Companion Sitemap Generator - HTML & XML scored78%from 54 tests.

About plugin

  • Plugin page: companion-sitemap...
  • Plugin version: 4.5.5
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Mar 8, 2016
  • Latest release: Sep 20, 2023
  • Number of updates: 175
  • Update frequency: every 15.8 days
  • Top authors: Papin (99.43%)Otto42 (1.14%)

Code review

54 tests

User reviews

53 reviews

Install metrics

8,000+ active /145,923 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼6.97ms] Passed 4 tests

A check of server-side resources used by Companion Sitemap Generator - HTML & XML
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0335.54 ▼4.96
Dashboard /wp-admin3.32 ▲0.0246.02 ▼2.13
Posts /wp-admin/edit.php3.37 ▲0.0244.11 ▼7.03
Add New Post /wp-admin/post-new.php5.90 ▲0.0287.06 ▼13.75
Media Library /wp-admin/upload.php3.24 ▲0.0242.54 ▲10.70
Sitemap /wp-admin/tools.php?page=csg-sitemap3.3635.66

Server storage [IO: ▲0.16MB] [DB: ▲0.00MB] 67% from 3 tests

Input-output and database impact of this plugin
Please fix the following
  • Illegal file modification detected: 1 file (0.00KB) outside of "wp-content/plugins/companion-sitemap-generator/" and "wp-content/uploads/"
    • (new file) sitemap.xml
Filesystem: 28 new files
Database: 1 new table, 7 new options
New tables
wp_csg_sitemap
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
db_upgraded
csg_db_version
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Companion Sitemap Generator - HTML & XML
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,843 ▲10813.62 ▼0.761.74 ▼0.0640.97 ▲0.06
Dashboard /wp-admin2,252 ▲644.86 ▼0.99102.30 ▼1.0041.95 ▼3.93
Posts /wp-admin/edit.php2,090 ▲12.19 ▲0.1434.99 ▼6.6235.91 ▲0.94
Add New Post /wp-admin/post-new.php6,588 ▲5,07429.38 ▲11.57888.45 ▲273.9154.28 ▼7.55
Media Library /wp-admin/upload.php1,392 ▲14.20 ▼0.01103.98 ▲4.8740.79 ▼4.12
Sitemap /wp-admin/tools.php?page=csg-sitemap1,4002.0323.1231.10

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

Smoke tests 50% 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
Almost there! Just fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/companion-sitemap-generator/companion_sitemap.php
  • 10× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function csg_get_posttypes() in wp-content/plugins/companion-sitemap-generator/dashboard/exclusion-posttypes.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/companion-sitemap-generator/dashboard/exclusion.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/companion-sitemap-generator/dashboard/start.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_get_schedule() in wp-content/plugins/companion-sitemap-generator/dashboard/dashboard.php:56
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/companion-sitemap-generator/dashboard/widget.php:22
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/companion-sitemap-generator/dashboard/exclusion-types.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/companion-sitemap-generator/csg_functions.php:589
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/companion-sitemap-generator/dashboard/additionalpages.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/companion-sitemap-generator/csg_gutenberg.php:45
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/companion-sitemap-generator/dashboard/exclusion-select.php:30

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 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Tags: Too many tags (17 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

companion-sitemap-generator/companion_sitemap.php 92% from 13 tests

The primary PHP file in "Companion Sitemap Generator - HTML & XML" version 4.5.5 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("companion-sitemap-generator.php" instead of "companion_sitemap.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin2,869 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP115371691,271
SVG966988
CSS31811344
XSLT1171171
JavaScript1151095

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions69
▷ Named functions69100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG images were found in this plugin