Skip to content

Commit 18fb1ac

Browse files
committed
black
1 parent 8e21c24 commit 18fb1ac

File tree

7 files changed

+41
-17
lines changed

7 files changed

+41
-17
lines changed

glitch/analysis/design/duplicate_block.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ def check(self, element: CodeElement, file: str) -> List[Error]:
4444
if i not in checked:
4545
line = self.__get_line(i, lines)
4646
error = Error(
47-
"design_duplicate_block", element, element.path, self.code_lines[line - 1]
47+
"design_duplicate_block",
48+
element,
49+
element.path,
50+
self.code_lines[line - 1],
4851
)
4952
error.line = line
5053
errors.append(error)
5154
checked.update(range(i, i + 150))
5255

53-
54-
return errors
56+
return errors

glitch/analysis/design/improper_alignment.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ def check(self, element: CodeElement, file: str) -> List[Error]:
1111
errors: List[Error] = []
1212
for i, line in enumerate(self.code_lines):
1313
if "\t" in line:
14-
error = Error("implementation_improper_alignment", element, element.path, repr(element))
14+
error = Error(
15+
"implementation_improper_alignment",
16+
element,
17+
element.path,
18+
repr(element),
19+
)
1520
error.line = i + 1
1621
errors.append(error)
1722
return errors

glitch/analysis/design/long_resource.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
class TooManyVariables(DesignSmellChecker):
9-
109
def check(self, element: CodeElement, file: str) -> List[Error]:
1110
if isinstance(element, AtomicUnit) and element.type in DesignVisitor.EXEC:
1211
lines = 0
@@ -18,4 +17,4 @@ def check(self, element: CodeElement, file: str) -> List[Error]:
1817
if lines > 7:
1918
return [Error("design_long_resource", element, file, repr(element))]
2019

21-
return []
20+
return []

glitch/analysis/design/long_statement.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ def check(self, element: CodeElement, file: str) -> List[Error]:
1111
if isinstance(element, UnitBlock) and element.type != UnitBlockType.block:
1212
for i, line in enumerate(self.code_lines):
1313
if len(line) > 140:
14-
error = Error("implementation_long_statement", element, element.path, line)
14+
error = Error(
15+
"implementation_long_statement", element, element.path, line
16+
)
1517
error.line = i + 1
1618
errors.append(error)
17-
18-
return errors
19+
20+
return errors

glitch/analysis/design/multifaceted_abstraction.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,27 @@
66

77

88
class TooManyVariables(DesignSmellChecker):
9-
109
def check(self, element: CodeElement, file: str) -> List[Error]:
1110
if isinstance(element, AtomicUnit) and element.type in DesignVisitor.EXEC:
1211
if isinstance(element.name, str) and (
1312
"&&" in element.name or ";" in element.name or "|" in element.name
1413
):
1514
return [
16-
Error("design_multifaceted_abstraction", element, file, repr(element))
15+
Error(
16+
"design_multifaceted_abstraction", element, file, repr(element)
17+
)
1718
]
1819
else:
1920
for attribute in element.attributes:
2021
value = repr(attribute.value)
2122
if "&&" in value or ";" in value or "|" in value:
2223
return [
23-
Error("design_multifaceted_abstraction", element, file, repr(element))
24+
Error(
25+
"design_multifaceted_abstraction",
26+
element,
27+
file,
28+
repr(element),
29+
)
2430
]
2531

26-
return []
32+
return []

glitch/analysis/design/too_many_variables.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,12 @@ def check(self, element: CodeElement, file: str) -> List[Error]:
2121
if (
2222
self.__count_variables(element.variables) / max(len(self.code_lines), 1) > 0.3 # type: ignore
2323
):
24-
return [Error("implementation_too_many_variables", element, element.path, repr(element))]
25-
return []
24+
return [
25+
Error(
26+
"implementation_too_many_variables",
27+
element,
28+
element.path,
29+
repr(element),
30+
)
31+
]
32+
return []

glitch/analysis/design/unguarded_variable.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class UnguardedVariable(DesignSmellChecker):
1010
def check(self, element: CodeElement, file: str) -> List[Error]:
1111
errors: List[Error] = []
1212

13-
if isinstance(element, UnitBlock) and DesignVisitor.VAR_REFER_SYMBOL is not None:
13+
if (
14+
isinstance(element, UnitBlock)
15+
and DesignVisitor.VAR_REFER_SYMBOL is not None
16+
):
1417
# FIXME could be improved if we considered strings as part of the model
1518
for i, l in enumerate(self.code_lines):
1619
for tuple in re.findall(
@@ -30,4 +33,4 @@ def check(self, element: CodeElement, file: str) -> List[Error]:
3033
error.line = i + 1
3134
errors.append(error)
3235

33-
return errors
36+
return errors

0 commit comments

Comments
 (0)