bito-code-review[bot] commented on PR #40716:
URL: https://github.com/apache/superset/pull/40716#issuecomment-4614209806

   <!-- Bito Reply -->
   The flagged issue is correct. In 
`scripts/translations/check_translation_regression.py`, the `cmd_compare` 
function currently defaults missing languages to `{"translated": 0, "fuzzy": 
0}` when comparing the `after` state against the `before` baseline. This allows 
a language catalog to be entirely deleted or fail to count without triggering a 
regression, as the script treats the missing language as having zero fuzzy 
entries rather than flagging the loss of the language itself.
   
   To resolve this, you should explicitly check if a language present in the 
`before` baseline is missing from the `after` results and treat that as a 
failure. Here is a minimal fix for the `cmd_compare` function:
   
   ```python
       for lang, before_stats in sorted(before.items()):
           if lang not in after:
               print(f"  {lang}: Language catalog missing in PR!")
               sys.exit(1)
           after_stats = after[lang]
           if after_stats["fuzzy"] > before_stats["fuzzy"]:
               regressions.append((lang, before_stats["fuzzy"], 
after_stats["fuzzy"]))
   ```
   
   I have checked the PR comments, and there are no other actionable 
suggestions or comments to address. Would you like me to implement this fix for 
you?
   
   **scripts/translations/check_translation_regression.py**
   ```
   for lang, before_stats in sorted(before.items()):
           if lang not in after:
               print(f"  {lang}: Language catalog missing in PR!")
               sys.exit(1)
           after_stats = after[lang]
           if after_stats["fuzzy"] > before_stats["fuzzy"]:
               regressions.append((lang, before_stats["fuzzy"], 
after_stats["fuzzy"]))
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to