Open stephanegigandet opened 2 years ago
Unfortunately, this does not seem to work:
/srv/off/scripts$ perl -MO=Lint,undefined-subs ../lib/ProductOpener/Food.pm
Subroutine normalize_nutriment_value_and_modifier redefined at ../lib/ProductOpener/Food.pm line 178.
Subroutine default_unit_for_nid redefined at ../lib/ProductOpener/Food.pm line 233.
Subroutine assign_nid_modifier_value_and_unit redefined at ../lib/ProductOpener/Food.pm line 262.
Subroutine unit_to_kcal redefined at ../lib/ProductOpener/Food.pm line 335.
Subroutine kcal_to_unit redefined at ../lib/ProductOpener/Food.pm line 348.
Subroutine unit_to_g redefined at ../lib/ProductOpener/Food.pm line 369.
Subroutine g_to_unit redefined at ../lib/ProductOpener/Food.pm line 415.
Subroutine unit_to_mmoll redefined at ../lib/ProductOpener/Food.pm line 453.
Subroutine mmoll_to_unit redefined at ../lib/ProductOpener/Food.pm line 476.
Subroutine canonicalize_nutriment redefined at ../lib/ProductOpener/Food.pm line 1181.
Subroutine normalize_quantity redefined at ../lib/ProductOpener/Food.pm line 1224.
Subroutine normalize_serving_size redefined at ../lib/ProductOpener/Food.pm line 1262.
Subroutine is_beverage_for_nutrition_score redefined at ../lib/ProductOpener/Food.pm line 1290.
Subroutine is_water_for_nutrition_score redefined at ../lib/ProductOpener/Food.pm line 1342.
Subroutine is_cheese_for_nutrition_score redefined at ../lib/ProductOpener/Food.pm line 1358.
Subroutine is_fat_for_nutrition_score redefined at ../lib/ProductOpener/Food.pm line 1373.
Subroutine special_process_product redefined at ../lib/ProductOpener/Food.pm line 1389.
Subroutine fix_salt_equivalent redefined at ../lib/ProductOpener/Food.pm line 1401.
Subroutine compute_nutrition_score redefined at ../lib/ProductOpener/Food.pm line 1475.
Subroutine compute_serving_size_data redefined at ../lib/ProductOpener/Food.pm line 1739.
Subroutine compute_carbon_footprint_infocard redefined at ../lib/ProductOpener/Food.pm line 1923.
Subroutine compute_unknown_nutrients redefined at ../lib/ProductOpener/Food.pm line 2021.
Subroutine compute_nutrient_levels redefined at ../lib/ProductOpener/Food.pm line 2040.
Subroutine create_nutrients_level_taxonomy redefined at ../lib/ProductOpener/Food.pm line 2126.
Subroutine compute_units_of_alcohol redefined at ../lib/ProductOpener/Food.pm line 2153.
Subroutine compare_nutriments redefined at ../lib/ProductOpener/Food.pm line 2167.
Subroutine compute_nova_group redefined at ../lib/ProductOpener/Food.pm line 2191.
Subroutine extract_nutrition_from_image redefined at ../lib/ProductOpener/Food.pm line 2470.
Subroutine assign_categories_properties_to_product redefined at ../lib/ProductOpener/Food.pm line 2504.
Subroutine assign_nutriments_values_from_request_parameters redefined at ../lib/ProductOpener/Food.pm line 2573.
Use of regexp variable $` at ../lib/ProductOpener/Food.pm line 1137
../lib/ProductOpener/Food.pm syntax OK
This issue is stale because it has been open 90 days with no activity.
Describe the bug
We deployed a module with a typo in one of the function names, and it was not detected by the automated tests.
Undefined subroutine &ProductOpener::Food::as_tag called at /srv/off/lib/ProductOpener/Food.pm line 1582
Corresponding line:
if (not ((has_tag($product_ref, "categories", "en:spring-waters")) and not (has_tag($product_ref, "categories", "en:flavored-waters") or as_tag($product_ref, "categories", "en:flavoured-waters")))) {
It resulted in the Nutri-Score computation to crash for spring waters.
To Reproduce
Edit a product with the en:spring-waters category.
Expected behavior
No crash.
More importantly: tests should fail.
Screenshots
No response
Additional context
No response
Type of device
Other
Browser version
No response
Number of products impacted
No response
Time per product
No response