google / google/yapf

yapf: disable flattens indentation when using tabs

Open
#673 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

For example, I have a block of code with varying levels of indentation covered by `# yapf: disable`. When `use_tabs = true`, yapf flattens all deep indentation down to one tab. When spaces are used, indentation is maintained as expected.

## .style.yapf

```
[style]
continuation_align_style = valign-right # or fixed
use_tabs = true
```

## Input

```python
def test():
# yapf: disable
return (
(x == 1) |
(x == 2) |
(
(x == 3) &
(y == 4)
)
)
# yapf: enable
```

## Output (yapf 0.26.0)

```python
def test():
# yapf: disable
return (
(x == 1) |
(x == 2) |
(
(x == 3) &
(y == 4)
)
)
# yapf: enable
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.