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

Use the indent-width setting for E111 and E114 #8705

Open
NeilGirdhar opened this issue Nov 15, 2023 · 11 comments
Open

Use the indent-width setting for E111 and E114 #8705

NeilGirdhar opened this issue Nov 15, 2023 · 11 comments
Labels
configuration Related to settings and configuration help wanted Contributions especially welcome rule Implementing or modifying a lint rule

Comments

@NeilGirdhar
Copy link

E111 should probably use the indent-width setting?

@NeilGirdhar NeilGirdhar changed the title Use the indent-width setting for E111 Use the indent-width setting for E111 and E114 Nov 15, 2023
@zanieb
Copy link
Member

zanieb commented Nov 15, 2023

Hm it looks like these intentionally do not use this setting since there are notes about conflict with the formatter and they explicitly mention using a width of "4" in the documentation. I'm not sure I have the context to approve changing this. cc @charliermarsh / @MichaReiser

@charliermarsh
Copy link
Member

I believe this is intentional since the pycodestyle rules are definitionally intended to adhere to PEP 8.

@zanieb zanieb added rule Implementing or modifying a lint rule configuration Related to settings and configuration labels Nov 15, 2023
@zanieb
Copy link
Member

zanieb commented Nov 15, 2023

Interestingly though, pycodestyle lets you configure the size.

@charliermarsh
Copy link
Member

Oh, it does?

@charliermarsh
Copy link
Member

Interesting.

@zanieb
Copy link
Member

zanieb commented Nov 15, 2023

Here's a start #8708 — let me know if you're interested in writing the tests.

@zanieb zanieb added the help wanted Contributions especially welcome label Nov 16, 2023
@charliermarsh
Copy link
Member

I thought I merged something related to this recently, but I can't find it...

@charliermarsh
Copy link
Member

Oh, I was thinking of #9506.

@asmaier
Copy link

asmaier commented Apr 26, 2024

There is also a documentation bug at https://docs.astral.sh/ruff/rules/#pycodestyle-e-w . It says

E111 Indentation is not a multiple of {indent_size}
...
E114 Indentation is not a multiple of {indent_size} (comment)

However in settings the variable is called indent-width, see https://docs.astral.sh/ruff/settings/#indent-width

@dhruvmanila
Copy link
Member

There is also a documentation bug at docs.astral.sh/ruff/rules/#pycodestyle-e-w . It says

E111 Indentation is not a multiple of {indent_size}
...
E114 Indentation is not a multiple of {indent_size} (comment)

However in settings the variable is called indent-width, see docs.astral.sh/ruff/settings/#indent-width

Ah, that's because it's the name of the variable used internally:

#[violation]
pub struct IndentationWithInvalidMultipleComment {
indent_size: usize,
}
impl Violation for IndentationWithInvalidMultipleComment {
#[derive_message_formats]
fn message(&self) -> String {
let Self { indent_size } = self;
format!("Indentation is not a multiple of {indent_size} (comment)")
}
}

I think we should just rename that to indent_width. Do you want to open a PR for that? @asmaier

@charliermarsh
Copy link
Member

Yeah let's just rename that variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration help wanted Contributions especially welcome rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants