Skip to content

[pylint] Add allow-dunder-method-names setting for bad-dunder-method-name (PLW3201)#8812

Merged
charliermarsh merged 2 commits intoastral-sh:mainfrom
ThiefMaster:custom-dunder-names
Nov 21, 2023
Merged

[pylint] Add allow-dunder-method-names setting for bad-dunder-method-name (PLW3201)#8812
charliermarsh merged 2 commits intoastral-sh:mainfrom
ThiefMaster:custom-dunder-names

Conversation

@ThiefMaster
Copy link
Copy Markdown
Contributor

closes #8732

I noticed that the reference to the setting in the rule docs doesn't work, but there seem to be something wrong with pylint settings in general in the docs - the "For related settings, see ...." is also missing there.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 21, 2023

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@zanieb
Copy link
Copy Markdown
Member

zanieb commented Nov 21, 2023

The related settings section is generated on build e.g.

for line in documentation.split_inclusive('\n') {
if line.starts_with("## ") {
in_options = line == "## Options\n";
} else if in_options {
if let Some(rest) = line.strip_prefix("- `") {
let option = rest.trim_end().trim_end_matches('`');
match Options::metadata().find(option) {
Some(OptionEntry::Field(field)) => {
if field.deprecated.is_some() {
eprintln!("Rule {rule_name} references deprecated option {option}.");
}
}
Some(_) => {}
None => {
panic!("Unknown option {option} referenced by rule {rule_name}");
}
}
let anchor = option.replace('.', "-");
out.push_str(&format!("- [`{option}`][{option}]\n"));
after.push_str(&format!("[{option}]: ../settings.md#{anchor}\n"));
continue;
}
}

@ThiefMaster
Copy link
Copy Markdown
Contributor Author

Huh, I thought I executed that script. anyway, that indeed fixed the problem of the broken linking. Still no idea why the link from the rules page to the settings page isn't generated, but that's unrelated to this PR anyway..

Copy link
Copy Markdown
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@charliermarsh charliermarsh added the configuration Related to settings and configuration label Nov 21, 2023
@charliermarsh charliermarsh changed the title Add custom-dunder-method-names setting for PLW3201 [pylint] Add allow-dunder-method-names setting for bad-dunder-method-name (PLW3201) Nov 21, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) November 21, 2023 23:40
@charliermarsh charliermarsh merged commit 948094e into astral-sh:main Nov 21, 2023
@ThiefMaster ThiefMaster deleted the custom-dunder-names branch November 21, 2023 23:44
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(🎁) bad-dunder-method-name config option

3 participants