Skip to content

Commit

Permalink
Bump static checks - pylint and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed Oct 20, 2024
1 parent d5a7204 commit 5aa98be
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 2 additions & 0 deletions gdtoolkit/formatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@


# pylint: disable-next=too-many-arguments
# pylint: disable=too-many-positional-arguments
# pylint: disable=too-many-arguments
def check_formatting_safety(
given_code: str,
formatted_code: str,
Expand Down
1 change: 1 addition & 0 deletions gdtoolkit/formatter/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# pylint: disable=too-many-arguments
# pylint: disable=too-many-instance-attributes
# pylint: disable=too-few-public-methods
# pylint: disable=too-many-positional-arguments
class Context:
def __init__(
self,
Expand Down
3 changes: 1 addition & 2 deletions gdtoolkit/linter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ def _fetch_problem_inactivity_ranges(gdscript_code: str) -> Dict[str, List[Range
for problem, range_ends in problem_range_ends.items():
for range_end in range_ends:
for a_range in problem_inactivity_ranges[problem]:
if range_end < a_range.end:
a_range.end = range_end
a_range.end = min(a_range.end, range_end)

return problem_inactivity_ranges

Expand Down
11 changes: 4 additions & 7 deletions gdtoolkit/parser/gdscript_indenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ def handle_NL(self, token: Token) -> Iterator[Token]:
indent = indent_str.count(" ") + indent_str.count("\t") * self.tab_len

if self.paren_level > 0:
for new_token in self._handle_lambdas_on_newline_token_in_parens(
yield from self._handle_lambdas_on_newline_token_in_parens(
token, indent, indent_str
):
yield new_token
)
# special handling for lambdas
return

Expand Down Expand Up @@ -64,14 +63,12 @@ def _process(self, stream):
self.paren_level += 1
elif token.type in self.CLOSE_PAREN_types:
while self.undedented_lambdas_at_paren_level[self.paren_level] > 0:
for new_token in self._dedent_lambda_at_token(token):
yield new_token
yield from self._dedent_lambda_at_token(token)
self.paren_level -= 1
assert self.paren_level >= 0
elif token.type in self.LAMBDA_SEPARATOR_types:
if self.undedented_lambdas_at_paren_level[self.paren_level] > 0:
for new_token in self._dedent_lambda_at_token(token):
yield new_token
yield from self._dedent_lambda_at_token(token)

if token.type != self.NL_type:
yield token
Expand Down
11 changes: 6 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ commands =
deps =
pytest > 5
hypothesis == 6.15.0
pylint == 3.0.3
pylint == 3.3.1
typing-extensions
mccabe
flake8 == 5.0.4
flake8 == 7.1.1
flake8-comprehensions
flake8-bugbear
commands =
Expand Down Expand Up @@ -78,9 +78,10 @@ commands =

[flake8]
ignore =
E121,E123,E126,E226,E24,E704,W503,W504 # defaults
, E203 # whitespace before ':'
, E231,E702,E275 # false-positives in Python 3.12
E121,E123,E126,E226,E24,E704,W503,W504
, E203
, E231,E702,E275
, F401
max-line-length = 100

[mypy-hypothesis]
Expand Down

0 comments on commit 5aa98be

Please sign in to comment.