11"""Implementation of Rule ST04."""
22
3+ from typing import List
4+
35from sqlfluff .core .parser import BaseSegment , Indent , NewlineSegment , WhitespaceSegment
46from sqlfluff .core .rules import BaseRule , LintFix , LintResult , RuleContext
57from 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