File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 22 ModelTransformer ,
33 Token
44)
5+ from robotidy .decorators import check_start_end_line
56
67
78EOL = Token (Token .EOL )
89CONTINUATION = Token (Token .CONTINUATION )
910
1011
1112class SplitTooLongLine (ModelTransformer ):
13+ """
14+ Split too long lines.
15+ If any line in keyword call exceeds given length limit (configurable using ``line_length``, 120 by default) it will be
16+ split::
17+
18+ Keyword With Longer Name ${arg1} ${arg2} ${arg3} # let's assume that arg2 is at 120 char
19+
20+ To::
21+
22+ Keyword With Longer Name ${arg1}
23+ ... ${arg2} ${arg3}
24+
25+ Using ``split_on_every_arg`` flag (``False`` by default), you can force the formatter to put every argument in a new line::
26+
27+ Keyword With Longer Name
28+ ... ${arg1}
29+ ... ${arg2}
30+ ... ${arg3}
31+
32+ Supports global formatting params: ``space_count``, ``--startline`` and ``--endline``.
33+ """
1234 def __init__ (self , line_length : int = 120 , split_on_every_arg : bool = False ):
1335 super ().__init__ ()
1436 self .line_length = line_length
1537 self .split_on_every_arg = split_on_every_arg
1638
39+ @check_start_end_line
1740 def visit_KeywordCall (self , node ): # noqa
1841 if all (line [- 1 ].end_col_offset < self .line_length for line in node .lines ):
1942 return node
You can’t perform that action at this time.
0 commit comments