-
Notifications
You must be signed in to change notification settings - Fork 205
add ruff #290
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
Open
fkromer
wants to merge
9
commits into
OWASP:master
Choose a base branch
from
fkromer:ruff
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add ruff #290
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
47c81c7
ruff: setup formatter
fkromer 31b39d9
ruff: format code
fkromer f01cf66
fix make fmt
fkromer c165734
make: add ruff analyze command
fkromer d42f096
ruff: add basic linting
fkromer 1f8a1bf
make: add fix command
fkromer ef0e09c
ruff: fix code
fkromer b233675
revert invalid fixes
fkromer 2c684d8
resolve merge conflicts
fkromer 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 hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,9 +10,58 @@ python = ">=3.9,<=3.11.13" | |
| pydal = "~20200714.1" | ||
|
|
||
| [tool.poetry.group.dev.dependencies] | ||
| black = "^25.9.0" | ||
| pdoc3 = "^0.11.6" | ||
| ruff = "^0.14.0" | ||
|
|
||
| [build-system] | ||
| requires = ["poetry>=0.12"] | ||
| build-backend = "poetry.masonry.api" | ||
|
|
||
| [tool.ruff] | ||
| target-version = "py310" | ||
|
|
||
| # https://docs.astral.sh/ruff/settings/#analyze | ||
| [tool.ruff.analyze] | ||
| detect-string-imports = false | ||
| direction = "dependencies" | ||
| exclude = [] | ||
| include-dependencies = {} | ||
| preview = false | ||
| string-imports-min-dots = 2 | ||
|
|
||
| # https://docs.astral.sh/ruff/settings/#format | ||
| [tool.ruff.format] | ||
| docstring-code-format = true | ||
| docstring-code-line-length = "dynamic" | ||
| exclude = [] | ||
| indent-style = "space" | ||
| line-ending = "lf" | ||
| preview = false | ||
| quote-style = "double" | ||
| skip-magic-trailing-comma = false | ||
|
|
||
| # https://docs.astral.sh/ruff/settings/#lint | ||
| [tool.ruff.lint] | ||
| allowed-confusables = [] | ||
| dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" | ||
| exclude = [] | ||
| explicit-preview-rules = false | ||
| extend-fixable = [] | ||
| extend-ignore = [] | ||
| extend-per-file-ignores = {} | ||
| extend-safe-fixes = [] | ||
| extend-select = [] | ||
| extend-unsafe-fixes = [] | ||
| external = [] | ||
| fixable = ["ALL"] | ||
| future-annotations = false | ||
| ignore = [] | ||
| ignore-init-module-imports = true | ||
| logger-objects = [] | ||
| per-file-ignores = {} | ||
| preview = false | ||
| select = ["E4", "E7", "E9", "F"] | ||
|
Contributor
Author
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.
|
||
| task-tags = ["TODO", "FIXME", "XXX"] | ||
| typing-extensions = true | ||
| typing-modules = [] | ||
| unfixable = [] | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 +1,53 @@ | ||
|
|
||
| class ReportUtils: | ||
| @staticmethod | ||
| def getParentName(element): | ||
| from pytm import Boundary | ||
| if (isinstance(element, Boundary)): | ||
|
|
||
| if isinstance(element, Boundary): | ||
| parent = element.inBoundary | ||
| if (parent is not None): | ||
| if parent is not None: | ||
| return parent.name | ||
| else: | ||
| return str("") | ||
| else: | ||
| return "ERROR: getParentName method is not valid for " + element.__class__.__name__ | ||
|
|
||
| return ( | ||
| "ERROR: getParentName method is not valid for " | ||
| + element.__class__.__name__ | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def getNamesOfParents(element): | ||
| from pytm import Boundary | ||
| if (isinstance(element, Boundary)): | ||
| parents = [p.name for p in element.parents()] | ||
| return parents | ||
|
|
||
| if isinstance(element, Boundary): | ||
| parents = [p.name for p in element.parents()] | ||
| return parents | ||
| else: | ||
| return "ERROR: getNamesOfParents method is not valid for " + element.__class__.__name__ | ||
| return ( | ||
| "ERROR: getNamesOfParents method is not valid for " | ||
| + element.__class__.__name__ | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def getFindingCount(element): | ||
| from pytm import Element | ||
| if (isinstance(element, Element)): | ||
|
|
||
| if isinstance(element, Element): | ||
| return str(len(list(element.findings))) | ||
| else: | ||
| return "ERROR: getFindingCount method is not valid for " + element.__class__.__name__ | ||
| return ( | ||
| "ERROR: getFindingCount method is not valid for " | ||
| + element.__class__.__name__ | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def getElementType(element): | ||
| from pytm import Element | ||
| if (isinstance(element, Element)): | ||
|
|
||
| if isinstance(element, Element): | ||
| return str(element.__class__.__name__) | ||
| else: | ||
| return "ERROR: getElementType method is not valid for " + element.__class__.__name__ | ||
| return ( | ||
| "ERROR: getElementType method is not valid for " | ||
| + element.__class__.__name__ | ||
| ) |
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.
Uh oh!
There was an error while loading. Please reload this page.