Skip to content

Commit

Permalink
tab indentation comment (#6079)
Browse files Browse the repository at this point in the history
## Summary

Updated doc comment for `tab_indentation.rs`. Online docs also benefit
from this update.

## Test Plan

Checked docs via
[mkdocs](https://github.com/astral-sh/ruff/blob/389fe13c934fe73679474006412b1eded4a2cad0/CONTRIBUTING.md?plain=1#L267-L296)
  • Loading branch information
arembridge authored Jul 25, 2023
1 parent 389fe13 commit 8c80bfa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/ruff/src/rules/pycodestyle/rules/tab_indentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::source_code::Indexer;
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]
pub struct TabIndentation;

Expand Down
1 change: 1 addition & 0 deletions scripts/check_docs_formatted.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"prohibited-trailing-comma",
"shebang-leading-whitespace",
"surrounding-whitespace",
"tab-indentation",
"too-few-spaces-before-inline-comment",
"trailing-comma-on-bare-tuple",
"triple-single-quotes",
Expand Down

0 comments on commit 8c80bfa

Please sign in to comment.