72% calorie-calculator

Code Review | Calorie Calculator

WordPress plugin Calorie Calculator scored72%from 54 tests.

About plugin

  • Plugin page: calorie-calculator
  • Plugin version: 3.2.9
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-6.0.2
  • WordPress version: 6.3.1
  • First release: Oct 8, 2016
  • Latest release: Oct 17, 2022
  • Number of updates: 66
  • Update frequency: every 33.4 days
  • Top authors: zubaer_ahammed (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

300+ active /15,217 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: ▼8.24MB] [CPU: ▼1,719,645.89ms] Passed 4 tests

A check of server-side resources used by Calorie Calculator
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.73 ▲0.2251.85 ▲7.06
Dashboard /wp-admin3.60 ▼33.4555.68 ▼6,878,533.56
Posts /wp-admin/edit.php3.44 ▲0.0431.95 ▼27.84
Add New Post /wp-admin/post-new.php6.18 ▲0.2585.70 ▼24.29
Media Library /wp-admin/upload.php3.52 ▲0.2441.39 ▲2.12
Add New /wp-admin/post-new.php?post_type=calculator_log3.5649.33
All Calculator Logs /wp-admin/edit.php?post_type=calculator_log3.5742.85

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 99 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
widget_zubaer-calorie-calculator
db_upgraded
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Calorie Calculator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,832 ▲8614.38 ▲1.201.96 ▼2.8343.53 ▲2.18
Dashboard /wp-admin2,241 ▲645.63 ▲0.0486.47 ▼1.1240.35 ▲2.53
Posts /wp-admin/edit.php2,143 ▲611.98 ▼0.0337.05 ▼1.7431.55 ▼4.41
Add New Post /wp-admin/post-new.php1,579 ▲5118.10 ▼5.11635.69 ▼23.0286.38 ▲35.54
Media Library /wp-admin/upload.php1,443 ▲434.12 ▲0.01102.62 ▼11.1943.56 ▼3.85
Add New /wp-admin/post-new.php?post_type=calculator_log1,5682.6860.5050.22
All Calculator Logs /wp-admin/edit.php?post_type=calculator_log1,1402.0943.4732.08

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_zubaer-calorie-calculator
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
  • 21 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=calculator_log
    • > Warning in wp-content/plugins/easy-age-verifier/lib/extras/wpApi.php+48
    file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known
  • 21 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=calculator_log
    • > Warning in wp-content/plugins/easy-age-verifier/lib/extras/wpApi.php+48
    file_get_contents(http://www.fillyourtaproom.com/wp-json/wp/v2/posts?per_page=10): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 11× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/calorie-calculator/templates/calculator_fields/general/email_field.php
    • > /wp-content/plugins/calorie-calculator/templates/widgets/calculator/bootstrap-general.php
    • > /wp-content/plugins/calorie-calculator/templates/calculator_fields/general/firstname_field.php
    • > /wp-content/plugins/calorie-calculator/templates/widgets/calculator/old.php
    • > /wp-content/plugins/calorie-calculator/templates/widgets/calculator/general.php
    • > /wp-content/plugins/calorie-calculator/templates/calculator_fields/general/height_field.php
    • > /wp-content/plugins/calorie-calculator/templates/calculator_fields/old/height_field.php
    • > /wp-content/plugins/calorie-calculator/templates/calculator_fields/general/weight_field.php
    • > /wp-content/plugins/calorie-calculator/templates/calculator_fields/general/fullname_field.php
    • > /wp-content/plugins/calorie-calculator/templates/calculator_fields/old/weight_field.php
  • 88× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: unit in wp-content/plugins/calorie-calculator/templates/calculator_fields/old/height_field.php on line 13
    • > PHP Notice
      Trying to get property 'calcalpro' of non-object in wp-content/plugins/calorie-calculator/templates/forms/old/calorie_calculator_us_unit_form.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/calorie-calculator/templates/calculator_fields/bootstrap-general/firstname_field.php:2
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_calculator_field() on null in wp-content/plugins/calorie-calculator/templates/forms/old/calorie_calculator_us_unit_form.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/calorie-calculator/templates/calculator_fields/bootstrap-general/submit_field.php:1
    • > PHP Notice
      Undefined variable: instance in wp-content/plugins/calorie-calculator/templates/widgets/calculator/general.php on line 20
    • > PHP Notice
      Undefined variable: unit in wp-content/plugins/calorie-calculator/templates/calculator_fields/bootstrap-general/height_field.php on line 2
    • > PHP Notice
      Undefined variable: first_name in wp-content/plugins/calorie-calculator/templates/calculator_fields/general/fullname_field.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/calorie-calculator/templates/calculator_fields/general/submit_field.php:1
    • > PHP Notice
      Undefined variable: object in wp-content/plugins/calorie-calculator/templates/forms/general/calorie_calculator_us_unit_form.php on line 6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: Add an image for screenshot #20 (Option to save user details in the user's Browser (Local Storage) so that they don't have to input ages, height, weight, etc. again and again.)
The official readme.txt might help

calorie-calculator/calorie-calculator.php 85% from 13 tests

The main file in "Calorie Calculator" v. 3.2.9 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Description: Keep the plugin description shorter than 140 characters (currently 281 characters long)
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin5,021 lines of code in 55 files:
LanguageFilesBlank linesComment linesLines of code
CSS53891732,069
PHP438033101,519
JavaScript1498110832
PO File1137369321
XML500280

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity41.00
▷ Minimum class complexity28.00
▷ Maximum class complexity64.00
Average method complexity2.90
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods63
▷ Static methods711.11%
▷ Public methods63100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants13
▷ Global constants13100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
38 PNG files occupy 4.05MB with 2.95MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-128x128.png28.11KB3.97KB▼ 85.88%
lib/jqueryui/base/images/ui-bg_glass_75_dadada_1x400.png0.32KB0.16KB▼ 50.46%
assets/screenshot-17.png187.46KB53.55KB▼ 71.43%
images/icon.png28.11KB3.97KB▼ 85.88%
assets/screenshot-19.png147.16KB42.76KB▼ 70.94%