我正试图让自己正确地缩进。它几乎可以完美运行,但是有些代码行存在问题。
例如:
$foo = something()
or Foo->throw(
'a string which is longer than -l line length. Gets wrapped to next line, but not indented further than line above'
);
应为:
$foo = something()
or Foo->throw(
'a string which is longer than -l line length. Gets wrapped to next line, but not indented further than line above'
);
此外,如果已经存在换行符,则缩进不正确:
$foo = something()
or Foo->throw(
'string'
);
应为:
$foo = something()
or Foo->throw(
'string'
);
很有趣的是,如果函数调用包含一个hashref ...,它将变得正确。
perltidyrc:
# Line
-l=78 # Max line width is 78 cols
-ole=unix # Unix line endings
# Indentation
-i=4 # Indent level is 4 cols
-ci=4 # Continuation indent is 4 cols
-dt=4 # Default tab size is 4 cols
-noll # Don't outdent long quoted strings or lines
# Comments
-iscl # Ignore inline comment (side comments) length
# Blank lines
-blbs=1 # Ensure a blank line before methods
-bbb # Ensure a blank line before blocks
-mbl=1 # Maximum consecutive blank lines
# Braces/parens/brackets
-nbl # Opening braces on same line (incl. methods)
-pt=0 # Low parenthesis tightness
-sbt=0 # Low square bracket tightness
-bt=0 # Low brace tightness
-bbt=0 # Low block brace tightness
# Semicolons
-nsfs # No space for semicolons within for loops
-nsts # No space before terminating semicolons
# Spaces / Tightness
-baao # Break after all operators
-bbao # Break before all operators
-cti=0 # No extra indentation for closing brackets
# General perltidy settings
-conv # Use as many iterations as necessary to beautify, until successive runs produce identical output (converge)
-b # Backup files and modify in-place
-se # Errors to STDERR
我来回走了很多路,都取得了不同程度的成功,但并没有设法使它完全正确。有指针吗?