Indentation clash with 'pylint' ('bad-continuation')
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
(_yapf 0.30.0_)
I would like the following code to stay as-is, i.e. the arguments (and the condition) should be indented by 8 spaces, but _yapf_ indents them with 4 spaces.
```
--- src/thing/core.py (original)
+++ src/thing/core.py (reformatted)
@@ -4,16 +4,16 @@
def function_alpha(
- parameter_one,
- parameter_two,
- parameter_three,
- parameter_four,
- parameter_five,
+ parameter_one,
+ parameter_two,
+ parameter_three,
+ parameter_four,
+ parameter_five,
):
"""Do something."""
if (
- parameter_one and parameter_two and parameter_three
- and parameter_four and parameter_five
+ parameter_one and parameter_two and parameter_three and parameter_four
+ and parameter_five
):
print(
parameter_one,
```
Indeed this format as done by _yapf_ clashes with _pylint_ and triggers `bad-continuation` messages from _pylint_:
```
************* Module thing.core
src/thing/core.py:7:0: C0330: Wrong hanging indentation before block (add 4 spaces).
parameter_one,
^ | (bad-continuation)
src/thing/core.py:8:0: C0330: Wrong hanging indentation before block (add 4 spaces).
parameter_two,
^ | (bad-continuation)
src/thing/core.py:9:0: C0330: Wrong hanging indentation before block (add 4 spaces).
parameter_three,
^ | (bad-continuation)
src/thing/core.py:10:0: C0330: Wrong hanging indentation before block (add 4 spaces).
parameter_four,
^ | (bad-continuation)
src/thing/core.py:11:0: C0330: Wrong hanging indentation before block (add 4 spaces).
parameter_five,
^ | (bad-continuation)
src/thing/core.py:15:0: C0330: Wrong hanging indentation before block (add 4 spaces).
parameter_one and parameter_two and parameter_three and parameter_four
^ | (bad-continuation)
src/thing/core.py:16:0: C0330: Wrong hanging indentation before block (add 4 spaces).
and parameter_five
^ | (bad-continuation)
```
This is the _style_ configuration used:
```
[style]
based_on_style = pep8
blank_line_before_nested_class_or_def = true
blank_line_before_module_docstring = true
dedent_closing_brackets = true
```
Is that _yapf_'s intended behaviour? Is there anything I can change in the configuration to obtain formatting that complies to _pylint_'s (8 space indentation for arguments)?
Contributor guide
Assessment
This issue has not been assessed yet.