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

[flake8-self] Ignore _name_ and _value_ #5663

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions crates/ruff/src/rules/flake8_self/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ use serde::{Deserialize, Serialize};

use ruff_macros::{CacheKey, CombineOptions, ConfigurationOptions};

// By default, ignore the `namedtuple` methods and attributes, which are underscore-prefixed to
// prevent conflicts with field names.
const IGNORE_NAMES: [&str; 5] = ["_make", "_asdict", "_replace", "_fields", "_field_defaults"];
// By default, ignore the `namedtuple` methods and attributes, as well as the
// _sunder_ names in Enum, which are underscore-prefixed to prevent conflicts
// with field names.
const IGNORE_NAMES: [&str; 7] = [
"_make",
"_asdict",
"_replace",
"_fields",
"_field_defaults",
"_name_",
"_value_",
];

#[derive(
Debug, PartialEq, Eq, Serialize, Deserialize, Default, ConfigurationOptions, CombineOptions,
Expand All @@ -19,7 +28,7 @@ const IGNORE_NAMES: [&str; 5] = ["_make", "_asdict", "_replace", "_fields", "_fi
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct Options {
#[option(
default = r#"["_make", "_asdict", "_replace", "_fields", "_field_defaults"]"#,
default = r#"["_make", "_asdict", "_replace", "_fields", "_field_defaults", "_name_", "_value_"]"#,
value_type = "list[str]",
example = r#"
ignore-names = ["_new"]
Expand Down