84% m-chart

Code Review | M Chart

WordPress plugin M Chart scored84%from 54 tests.

About plugin

  • Plugin page: m-chart
  • Plugin version: 1.10.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-6.2.2
  • WordPress version: 6.3.1
  • First release: Apr 27, 2015
  • Latest release: Jun 27, 2023
  • Number of updates: 108
  • Update frequency: every 27.6 days
  • Top authors: methnen (100%)

Code review

54 tests

User reviews

27 reviews

Install metrics

4,000+ active /75,257 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.41MB] [CPU: ▼1.13ms] Passed 4 tests

This is a short check of server-side resources used by M Chart
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.78 ▲0.3146.55 ▲5.91
Dashboard /wp-admin3.77 ▲0.4651.49 ▼4.03
Posts /wp-admin/edit.php3.85 ▲0.4956.19 ▲4.86
Add New Post /wp-admin/post-new.php6.32 ▲0.43102.90 ▼4.97
Media Library /wp-admin/upload.php3.66 ▲0.4339.74 ▼0.38
Settings /wp-admin/edit.php?post_type=m-chart&page=m-chart-settings4.1153.37
Charts /wp-admin/edit.php?post_type=m-chart3.7243.09
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=m-chart3.6642.77
Chart Units /wp-admin/edit-tags.php?taxonomy=m-chart-units&post_type=m-chart3.6639.72
Add Chart /wp-admin/post-new.php?post_type=m-chart4.17375.91
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=m-chart3.6641.19

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 79 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
m-chart-units_children
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
category_children
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

M Chart: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,950 ▲20413.54 ▼0.845.70 ▲4.1142.39 ▲0.47
Dashboard /wp-admin2,252 ▲614.86 ▼0.08111.57 ▲5.4041.27 ▼5.43
Posts /wp-admin/edit.php2,132 ▲431.99 ▼0.0441.24 ▲4.0935.21 ▼1.53
Add New Post /wp-admin/post-new.php1,549 ▲1617.61 ▼5.66598.38 ▼97.8250.99 ▼22.28
Media Library /wp-admin/upload.php1,434 ▲464.29 ▲0.1098.62 ▼5.3140.96 ▼2.66
Settings /wp-admin/edit.php?post_type=m-chart&page=m-chart-settings3,9402.1826.6933.72
Charts /wp-admin/edit.php?post_type=m-chart1,2031.9331.3030.94
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=m-chart1,4862.1428.8835.45
Chart Units /wp-admin/edit-tags.php?taxonomy=m-chart-units&post_type=m-chart1,3082.1326.3228.99
Add Chart /wp-admin/post-new.php?post_type=m-chart4,3126.28340.4254.32
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=m-chart1,3502.2729.8729.69

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
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • category_children
    • m-chart-units_children
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded

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)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 19× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: chart in wp-content/plugins/m-chart/components/templates/chart-meta-box.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/m-chart/components/templates/spreadsheet-meta-box.php:5
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/m-chart/components/templates/iframe.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/m-chart/components/templates/subtitle-field.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/m-chart/components/templates/m-chart-settings-chartjs.php:1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/m-chart/components/templates/share.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/m-chart/components/templates/m-chart-settings.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'ParseCsv\\enums\\AbstractEnum' not found in wp-content/plugins/m-chart/components/external/parsecsv/src/enums/SortEnum.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function m_chart() in wp-content/plugins/m-chart/components/templates/chartjs-chart.php:2
    • > PHP Fatal error
      Trait 'ParseCsv\\extensions\\DatatypeTrait' not found in wp-content/plugins/m-chart/components/external/parsecsv/src/Csv.php on line 10

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 Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
6 plugin tags: highcharts, chartjs, charts, wordpress, graphs...

m-chart/m-chart.php Passed 13 tests

The main PHP file in "M Chart" ver. 1.10.1 adds more information about the plugin and also serves as the entry point for this plugin
57 characters long description:
Manage data sets and display them as charts in WordPress.

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
There were no executable files found in this plugin10,117 lines of code in 63 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript91,0766794,493
PHP297991,4244,315
PO File2292316630
CSS21033367
SVG20011284
Markdown15028

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity57.55
▷ Minimum class complexity1.00
▷ Maximum class complexity218.00
Average method complexity5.86
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces3
Interfaces0
Traits1
Classes10
▷ Abstract classes110.00%
▷ Concrete classes990.00%
▷ Final classes00.00%
Methods128
▷ Static methods97.03%
▷ Public methods10884.38%
▷ Protected methods129.38%
▷ Private methods86.25%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants16
▷ Global constants00.00%
▷ Class constants16100.00%
▷ Public constants16100.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
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
components/images/chart-placeholder.png19.50KB8.18KB▼ 58.03%