Skip to content

Update D208 to preserve indentation offsets when fixing overindented lines#8699

Merged
zanieb merged 3 commits into
mainfrom
zanie/fix-d208
Nov 17, 2023
Merged

Update D208 to preserve indentation offsets when fixing overindented lines#8699
zanieb merged 3 commits into
mainfrom
zanie/fix-d208

Conversation

@zanieb

@zanieb zanieb commented Nov 15, 2023

Copy link
Copy Markdown
Member

Closes #8695

We track the smallest offset seen for overindented lines then only reduce the indentation of the lines that far to preserve indentation in other lines. This rule's behavior now matches our formatter, which is nice.

We may want to gate this with preview.

@zanieb zanieb added the rule Implementing or modifying a lint rule label Nov 15, 2023
@zanieb zanieb added the docstring Related to docstring linting or formatting label Nov 15, 2023
@github-actions

github-actions Bot commented Nov 15, 2023

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@zanieb zanieb marked this pull request as ready for review November 16, 2023 20:00
Comment thread crates/ruff_linter/src/rules/pydocstyle/rules/indent.rs Outdated

@BurntSushi BurntSushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@zanieb

zanieb commented Nov 17, 2023

Copy link
Copy Markdown
Member Author

@charliermarsh any thoughts on preview? It seems like best practice?

@charliermarsh charliermarsh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding correctly that this only affects the fix, I would be fine shipping this to stable.

@charliermarsh

Copy link
Copy Markdown
Member

(But defer to you as the author.)

@zanieb zanieb merged commit bd99175 into main Nov 17, 2023
@zanieb zanieb deleted the zanie/fix-d208 branch November 17, 2023 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docstring Related to docstring linting or formatting rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D208 should outdent whole blocks and not line-byline

3 participants