Skip to content

Commit

Permalink
tab indentation comment
Browse files Browse the repository at this point in the history
Added a tab indentation doc comment (also for use in online docs)
  • Loading branch information
arembridge committed Jul 25, 2023
1 parent 389fe13 commit 530a148
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 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,24 @@ 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:\n\ta = 1
/// ```
///
/// Use instead:
/// ```python
/// if True:\n a = 1
/// ```
///
/// [PEP 8]: https://peps.python.org/pep-0008/#tabs-or-spaces
#[violation]
pub struct TabIndentation;

Expand Down

0 comments on commit 530a148

Please sign in to comment.