Skip to content

Commit 5d37726

Browse files
committed
Add type hints for return types on ST04 functions
1 parent 9fa1636 commit 5d37726

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • src/sqlfluff/rules/structure

src/sqlfluff/rules/structure/ST04.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Implementation of Rule ST04."""
22

3+
from typing import List
4+
35
from sqlfluff.core.parser import BaseSegment, Indent, NewlineSegment, WhitespaceSegment
46
from sqlfluff.core.rules import BaseRule, LintFix, LintResult, RuleContext
57
from sqlfluff.core.rules.crawlers import SegmentSeekerCrawler
@@ -164,7 +166,7 @@ def _get_indentation(
164166
segment: BaseSegment,
165167
tab_space_size: int,
166168
indent_unit: str,
167-
):
169+
) -> str:
168170
"""Calculate the indentation level for rebuilding nested struct.
169171
170172
This is only a best attempt as the input may not be equally indented. The layout
@@ -198,7 +200,7 @@ def _nested_end_trailing_comment(
198200
case1_children: Segments,
199201
case1_else_clause_seg: BaseSegment,
200202
end_indent_str: str,
201-
):
203+
) -> List[LintFix]:
202204
"""Prepend newline spacing to comments on the final nested `END` line."""
203205
trailing_end = case1_children.select(
204206
start_seg=case1_else_clause_seg,
@@ -213,7 +215,9 @@ def _nested_end_trailing_comment(
213215
fixes.append(LintFix.create_before(first_comment, segments, segments))
214216
return fixes
215217

216-
def _rebuild_spacing(self, indent_str: str, nested_clauses: Segments):
218+
def _rebuild_spacing(
219+
self, indent_str: str, nested_clauses: Segments
220+
) -> List[BaseSegment]:
217221
buff = []
218222
# If the first segment is a comment, add a newline
219223
prior_newline = nested_clauses.first(sp.not_(sp.is_whitespace())).any(

0 commit comments

Comments
 (0)