Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
Nfsaavedra committed Apr 29, 2024
1 parent 87b3aa1 commit fd4dc8f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion glitch/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __parse_and_check(
) -> Set[Error]:
errors: Set[Error] = set()
inter = parser.parse(path, type, module)
# Avoids problems with multiple threads (and possibly multiple files)
# Avoids problems with multiple threads (and possibly multiple files)
# sharing the same object
analyses = deepcopy(analyses)

Expand Down
4 changes: 1 addition & 3 deletions glitch/analysis/design/long_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def check(self, element: CodeElement, file: str) -> List[Error]:
if isinstance(element, UnitBlock) and element.type != UnitBlockType.block:
for i, line in enumerate(self.code_lines):
if len(line) > 140:
error = Error(
"implementation_long_statement", element, file, line
)
error = Error("implementation_long_statement", element, file, line)
error.line = i + 1
errors.append(error)

Expand Down
5 changes: 4 additions & 1 deletion glitch/parsers/gha.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def __parse_job(self, key: Node, value: Node, lines: List[str]) -> UnitBlock:
au_type = step_dict["uses"]

au = AtomicUnit(name, au_type)
au.line, au.column = step.start_mark.line + 1, step.start_mark.column + 1
au.line, au.column = (
step.start_mark.line + 1,
step.start_mark.column + 1,
)
au.code = GithubActionsParser._get_code(step, step, lines)

for key, value in step.value:
Expand Down
8 changes: 5 additions & 3 deletions glitch/tests/design/gha/test_design.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import unittest

from glitch.analysis.design.visitor import DesignVisitor
from glitch.analysis.rules import Error
from glitch.analysis.rules import Error
from glitch.parsers.gha import GithubActionsParser
from glitch.tech import Tech
from glitch.repr.inter import UnitBlockType
from typing import List


class TestDesign(unittest.TestCase):
def __help_test(self, path: str, n_errors: int, codes: List[str], lines: List[int]) -> None:
def __help_test(
self, path: str, n_errors: int, codes: List[str], lines: List[int]
) -> None:
parser = GithubActionsParser()
inter = parser.parse(path, UnitBlockType.script, False)
assert inter is not None
Expand All @@ -20,7 +22,7 @@ def __help_test(self, path: str, n_errors: int, codes: List[str], lines: List[in
filter(
lambda e: e.code.startswith("design_")
or e.code.startswith("implementation_"),
errors
errors,
)
)
errors = sorted(errors, key=lambda e: (e.path, e.line, e.code))
Expand Down

0 comments on commit fd4dc8f

Please sign in to comment.