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

Use sum() directly over boolean values in logging statements #3821

Closed
suhaibmujahid opened this issue Nov 19, 2023 · 0 comments · Fixed by #3852
Closed

Use sum() directly over boolean values in logging statements #3821

suhaibmujahid opened this issue Nov 19, 2023 · 0 comments · Fixed by #3852
Labels
good-first-bug Good for newcomers

Comments

@suhaibmujahid
Copy link
Member

An example of not using the boolean values directly:

logger.info(
"%d commits that cannot be ignored",
sum(1 for label in classes.values() if label == 0),
)

Preferred approach:

 logger.info( 
     "%d commits that cannot be ignored", 
     sum(label == 0 for label in classes.values()), 
 ) 
@suhaibmujahid suhaibmujahid added the good-first-bug Good for newcomers label Nov 19, 2023
StarKBhaviN added a commit to StarKBhaviN/bugbug that referenced this issue Nov 25, 2023
- Also i found some logging statements that using f string formatting.
StarKBhaviN added a commit to StarKBhaviN/bugbug that referenced this issue Nov 26, 2023
- Also i found some logging statements that using f string formatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-bug Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant