astral-sh / astral-sh/ruff

E101 False positive in multiline string

Open
#7,906 3 comments 1 reaction 0 assignees View on GitHub
needs-decision needs-info
Dominant language
Rust
Stars
49.6k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
445

Description

I have a python model that contains rest endpoint queries defined as multi-line strings, i.e.

```
query = """
query ...
"""
```

`ruff` is reporting `E101 Indentation contains mixed spaces and tabs` for the text inside the string.

Technically this is correct as the indentation of the query does contain a mix of tab and spaces - but in general, I feel that `ruff` shouldn't try and lint a text block.

Note I observed this in a notebook - I've not tested in a py file

Contributor guide

Open the contributing guide

Research direction

Start by reproducing E101 Indentation contains mixed spaces and tabs from the reported Python notebook example, then compare the behavior with an equivalent .py file because the report does not test one. Done means Ruff no longer reports E101 for indentation inside the multiline string while still detecting the issue in ordinary Python code.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.