-
Notifications
You must be signed in to change notification settings - Fork 18
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
Handle ruff warnings #215
Merged
Merged
Handle ruff warnings #215
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0becd23
ruff: move T201 warning to specific line
patrit d8aed2d
ruff: fix I001
patrit c6b534e
ruff: fix B007
patrit d8bc42d
ruff: move FIX002 warning to specific line
patrit fa53171
ruff: fix ERA001
patrit 5265b97
ruff: fix PLC0208
patrit 4ceba11
ruff: move S106 into generic tests section
patrit 0144ed4
ruff: fix RUF015
patrit e95077f
ruff: move ARG002 warning to specific line
patrit 1577cbe
ruff: fix RSE102
patrit 643d887
ruff: fix N802
patrit dc1452d
ruff: fix PLR2004
patrit 8143e59
ruff: fix SIM*
patrit 90b0292
ruff: disable S108 for tests and disable per line otherwise
patrit 94b789e
ruff: fix E501
patrit 1c87b62
ruff: fix TRY* or indicate by line
patrit a893e60
ruff: move N818 warning to specific line
patrit 72ff482
ruff: move PD011 warning to specific line
patrit 6a2149e
ruff: disable ANN* for tests and fix others
patrit aaabf8d
ruff: fix INP001
patrit 481e8b1
ruff: disable PT009 for all tests
patrit bc99135
ruff: move S105 warning to specific line
patrit 0176ee2
ruff: fix RUF012
patrit 963adba
ruff: move B024 warning to specific line
patrit 052a443
ruff: fix RET504
patrit 8949046
ruff: move ARG* warning to specific line
patrit c084a6a
ruff: fix UP015
patrit 15cd22b
ruff: move PLW2901 warning to specific line
patrit 4de62d7
ruff: fix PLR5501
patrit 9207382
ruff: fix FBT003
patrit 5be9799
ruff: fix PYI016
patrit 5495fc1
ruff: fix PT018
patrit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
class GitOpsException(Exception): | ||
class GitOpsException(Exception): # noqa: N818 | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
|
||
def create_tmp_dir() -> str: | ||
tmp_dir = f"/tmp/gitopscli/{uuid.uuid4()}" | ||
tmp_dir = f"/tmp/gitopscli/{uuid.uuid4()}" # noqa: S108 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cleaning these up might be a step towards windows support (#187) |
||
os.makedirs(tmp_dir) | ||
return tmp_dir | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,20 +10,20 @@ | |
YAML_INSTANCE.preserve_quotes = True | ||
|
||
|
||
class YAMLException(Exception): | ||
class YAMLException(Exception): # noqa: N818 | ||
pass | ||
|
||
|
||
def yaml_file_load(file_path: str) -> Any: | ||
with open(file_path, "r", encoding=locale.getpreferredencoding(False)) as stream: | ||
with open(file_path, encoding=locale.getpreferredencoding(do_setlocale=False)) as stream: | ||
try: | ||
return YAML_INSTANCE.load(stream) | ||
except YAMLError as ex: | ||
raise YAMLException(f"Error parsing YAML file: {file_path}") from ex | ||
|
||
|
||
def yaml_file_dump(yaml: Any, file_path: str) -> None: | ||
with open(file_path, "w+", encoding=locale.getpreferredencoding(False)) as stream: | ||
with open(file_path, "w+", encoding=locale.getpreferredencoding(do_setlocale=False)) as stream: | ||
YAML_INSTANCE.dump(yaml, stream) | ||
|
||
|
||
|
@@ -73,14 +73,13 @@ def merge_yaml_element(file_path: str, element_path: str, desired_value: Any) -> | |
work_path = work_path[key] | ||
|
||
for key, value in desired_value.items(): | ||
if key in work_path: | ||
if work_path[key] is not None: | ||
value = {**work_path[key], **value} | ||
if key in work_path and work_path[key] is not None: | ||
value = {**work_path[key], **value} # noqa: PLW2901 | ||
work_path[key] = value | ||
|
||
# delete missing key: | ||
current = work_path.copy().items() | ||
for key, value in current: | ||
for key, _ in current: | ||
Comment on lines
81
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could just drop |
||
if key not in desired_value: | ||
del work_path[key] | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this seems like a false positive 🤔