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

Add flake8-logging and flake8-logging-format ruff rules #999

Merged
merged 3 commits into from
Jul 22, 2024

Conversation

collindutter
Copy link
Member

Describe your changes

Add flake8-logging and flake8-logging-format ruff rules.

Issue ticket number and link

#995

Copy link
Contributor

@dylanholmes dylanholmes left a comment

Choose a reason for hiding this comment

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

Just one real question

logging.error(f"Error while loading entry: {e}")
logging.exception("Error while loading entry: %s", e)
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to complain about not using f-strings, but the argument in G004 about deferring string formatting speaks to me. TIL

(Would be even cooler if the formatted values could be lazily computed too)

self.structure.logger.error(f"Subtask {self.origin_task.id}\nError parsing tool action: {e}")
self.structure.logger.error("Subtask %s\nError parsing tool action: %s", self.id, e)
Copy link
Contributor

Choose a reason for hiding this comment

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

Was self.origin_task.id -> self.id intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, no

self.structure.logger.info(f"{self.__class__.__name__} {self.id}\nInput: {self.input.to_text()}")
self.structure.logger.info("%s %s\nInput: %s", self.__class__.__name__, self.id, self.input.to_text())
Copy link
Contributor

Choose a reason for hiding this comment

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

This is one case where I might favor readability over the micro-optimization of lazy string formatting, but 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, but 🤷

@collindutter collindutter merged commit 3767c86 into dev Jul 22, 2024
12 of 13 checks passed
@collindutter collindutter deleted the feature/ruff-logging branch July 22, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants