-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(checks): detect extra curly braces in Python brace format #12198
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12198 +/- ##
==========================================
- Coverage 90.82% 90.34% -0.48%
==========================================
Files 554 583 +29
Lines 57306 59966 +2660
Branches 9122 9604 +482
==========================================
+ Hits 52046 54176 +2130
- Misses 3640 3993 +353
- Partials 1620 1797 +177
|
Thank you for this quick response. Other cases:
Maybe my own solution (related to PR bit-dev/backintime#1829) using a combination of regex can give you some inspiration. I also encountered strings like this: EDIT: And just a learning question for me as a maintainer. Don't you have a review policy for code changes in your project? Aren't there other reviews in the team? |
@@ -340,7 +344,9 @@ def normalize(self, matches: list[str]) -> list[str]: | |||
def extract_matches(self, string: str) -> list[str]: | |||
return [self.cleanup_string(x[0]) for x in self.regexp.findall(string)] | |||
|
|||
def check_format(self, source: str, target: str, ignore_missing, unit: Unit): | |||
def check_format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc strings has potential to be improved. Not clear what it does. Arguments and return values are unclear.
Because of that I am unable to value the new unit tests using this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the documentation always has potential to get improved. Currently, I'm at least focusing on adding type annotations when touching the code.
- look for escaped braces in the original string as well - treat { } escapes same as with % - remove bogus detection of % placeable - detect any stray { } besides parsed format string See WeblateOrg#12198 and WeblateOrg#12197
#12199 should improve this. There is currently nobody to do a review, but I hope this to change soon as some new team members will get fully onboarded. |
Are you and the planed reviewers employed by Weblate company? |
Proposed changes
Fixes #12197
Checklist
Other information