Skip to content
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

Make percentage_format_string support str.format() syntax #403

Merged
merged 6 commits into from Aug 16, 2021
Merged

Make percentage_format_string support str.format() syntax #403

merged 6 commits into from Aug 16, 2021

Conversation

iamxeph
Copy link
Contributor

@iamxeph iamxeph commented Aug 15, 2021

Description

This PR make percentage_format_string support str.format() syntax in addition to old %-format syntax.

Checklist

Questions or Comments

@@ -1308,3 +1308,9 @@ def percentage_violation(self, match_percentage):
if 'min_percentage' in self.rules and match_percentage < self.rules['min_percentage']:
return True
return False

def format_string(self, format_config, target_value):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving this format_string() into a util class so that it doesn't get repeated here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved format_string() to util.py and added tests for the function accordingly

@iamxeph iamxeph changed the title Make percentage_format_string support format() syntax Make percentage_format_string support str.format() syntax Aug 16, 2021
Copy link
Owner

@jertel jertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jertel jertel merged commit f469e44 into jertel:master Aug 16, 2021
@iamxeph iamxeph deleted the feature_add_support_format_syntax_to_percentagematch branch August 16, 2021 13:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants