Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruff rules for whitespace #67

Merged
merged 1 commit into from
May 14, 2024

Conversation

cclauss
Copy link
Collaborator

@cclauss cclauss commented May 14, 2024

% ruff check --select=W --statistics

50	W191	[ ] Indentation contains tabs
 3	W293	[*] Blank line contains whitespace
 2	W291	[*] Trailing whitespace

% ruff rule W191

tab-indentation (W191)

Derived from the pycodestyle linter.

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

if True:
	a = 1

Use instead:

if True:
    a = 1

Formatter compatibility

We recommend against using this rule alongside the formatter. The
formatter enforces consistent indentation, making the rule redundant.

The rule is also incompatible with the formatter when using
format.indent-style="tab".

@cclauss cclauss requested a review from nwhitehead May 14, 2024 16:21
@cclauss cclauss force-pushed the ruff-rules-for-whitespace branch from 817f9a3 to aeea57c Compare May 14, 2024 16:23
@nwhitehead nwhitehead merged commit 6417932 into nwhitehead:master May 14, 2024
5 checks passed
@cclauss cclauss deleted the ruff-rules-for-whitespace branch May 14, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants