mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
tab indentation comment (#6079)
## Summary
Updated doc comment for `tab_indentation.rs`. Online docs also benefit
from this update.
## Test Plan
Checked docs via
[mkdocs](389fe13c93/CONTRIBUTING.md (L267-L296)
)
This commit is contained in:
parent
389fe13c93
commit
8c80bfa7da
2 changed files with 21 additions and 0 deletions
|
@ -5,6 +5,26 @@ use ruff_macros::{derive_message_formats, violation};
|
||||||
use ruff_python_ast::source_code::Indexer;
|
use ruff_python_ast::source_code::Indexer;
|
||||||
use ruff_python_trivia::{leading_indentation, Line};
|
use ruff_python_trivia::{leading_indentation, Line};
|
||||||
|
|
||||||
|
/// ## What it does
|
||||||
|
/// Checks for indentation that uses tabs.
|
||||||
|
///
|
||||||
|
/// ## Why is this bad?
|
||||||
|
/// According to [PEP 8], spaces are preferred over tabs (unless used to remain
|
||||||
|
/// consistent with code that is already indented with tabs).
|
||||||
|
///
|
||||||
|
/// ## Example
|
||||||
|
/// ```python
|
||||||
|
/// if True:
|
||||||
|
/// a = 1
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// Use instead:
|
||||||
|
/// ```python
|
||||||
|
/// if True:
|
||||||
|
/// a = 1
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// [PEP 8]: https://peps.python.org/pep-0008/#tabs-or-spaces
|
||||||
#[violation]
|
#[violation]
|
||||||
pub struct TabIndentation;
|
pub struct TabIndentation;
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ KNOWN_FORMATTING_VIOLATIONS = [
|
||||||
"prohibited-trailing-comma",
|
"prohibited-trailing-comma",
|
||||||
"shebang-leading-whitespace",
|
"shebang-leading-whitespace",
|
||||||
"surrounding-whitespace",
|
"surrounding-whitespace",
|
||||||
|
"tab-indentation",
|
||||||
"too-few-spaces-before-inline-comment",
|
"too-few-spaces-before-inline-comment",
|
||||||
"trailing-comma-on-bare-tuple",
|
"trailing-comma-on-bare-tuple",
|
||||||
"triple-single-quotes",
|
"triple-single-quotes",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue