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

Apply simple Ruff fixes #1105

Merged
merged 1 commit into from
May 27, 2024
Merged

Conversation

SqAtx
Copy link
Contributor

@SqAtx SqAtx commented May 25, 2024

Relates to #237

With one exception, this is the output of ruff lint --fix. The changes look minor - it mostly removes unused imports.

Ruff reports a lot of other errors, including a fair amount of "Undefined name" that indicate broken code paths. We can tackle those separately, and decide whether we want to add Ruff to the pre-commit hook.

This commit in itself is still a good quality of life improvement.

I also did some smoke testing to make sure nothing is obviously broken.

Relates to getting-things-gnome#237

With one exception, this is the output of `ruff lint --fix`. The changes
look minor - it mostly removes unused imports.

Ruff reports a lot of other errors, including a fair amount of
"Undefined name" that indicate broken code paths. We can tackle those
separately, and decide whether we want to add Ruff to the pre-commit
hook.

This commit in itself is still a good quality of life improvement.

I also did some smoke testing to make sure nothing is obviously broken.
@@ -165,7 +165,7 @@ def get(self, option):
if value is None and default_value is None:
raise ValueError(
'No valid configuration value or default value was '
'found for %s in %s'.format(option, self._section_name))
f'found for {option} in {self._section_name}')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ruff originally called this a violation of string-dot-format-extra-positional-arguments (F523) and proposed to make it

'found for %s in %s'.format())

which was obviously not what the code is intended to be. The correct fix would have been

'found for {} in {}'.format(option, self._section_name))

but I figured it makes more sense to use an fstring.

@SqAtx SqAtx marked this pull request as ready for review May 25, 2024 21:53
@diegogangl diegogangl added enhancement maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers labels May 27, 2024
@diegogangl diegogangl merged commit c2f650f into getting-things-gnome:master May 27, 2024
1 check passed
@diegogangl
Copy link
Contributor

Looks good, thanks!

@SqAtx SqAtx deleted the ruff_fixes branch July 7, 2024 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement maintainability Automated tests suite, tooling, refactoring, or anything that makes it easier for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants