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:
rembridge 2023-07-26 00:14:43 +01:00 committed by GitHub
parent 389fe13c93
commit 8c80bfa7da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -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;

View file

@ -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",