Skip to content

Commit

Permalink
Support extend-select in pyproject.toml (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersk authored Oct 4, 2022
1 parent 44897b2 commit f80d5e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pyproject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ pub struct Config {
pub extend_exclude: Vec<String>,
pub select: Option<Vec<CheckCode>>,
#[serde(default)]
pub extend_select: Vec<CheckCode>,
#[serde(default)]
pub ignore: Vec<CheckCode>,
#[serde(default)]
pub per_file_ignores: Vec<StrCheckCodePair>,
Expand Down Expand Up @@ -180,6 +182,7 @@ mod tests {
exclude: None,
extend_exclude: vec![],
select: None,
extend_select: vec![],
ignore: vec![],
per_file_ignores: vec![],
dummy_variable_rgx: None,
Expand All @@ -202,6 +205,7 @@ line-length = 79
exclude: None,
extend_exclude: vec![],
select: None,
extend_select: vec![],
ignore: vec![],
per_file_ignores: vec![],
dummy_variable_rgx: None,
Expand All @@ -224,6 +228,7 @@ exclude = ["foo.py"]
exclude: Some(vec!["foo.py".to_string()]),
extend_exclude: vec![],
select: None,
extend_select: vec![],
ignore: vec![],
per_file_ignores: vec![],
dummy_variable_rgx: None,
Expand All @@ -246,6 +251,7 @@ select = ["E501"]
exclude: None,
extend_exclude: vec![],
select: Some(vec![CheckCode::E501]),
extend_select: vec![],
ignore: vec![],
per_file_ignores: vec![],
dummy_variable_rgx: None,
Expand All @@ -257,6 +263,7 @@ select = ["E501"]
r#"
[tool.black]
[tool.ruff]
extend-select = ["M001"]
ignore = ["E501"]
"#,
)?;
Expand All @@ -268,6 +275,7 @@ ignore = ["E501"]
exclude: None,
extend_exclude: vec![],
select: None,
extend_select: vec![CheckCode::M001],
ignore: vec![CheckCode::E501],
per_file_ignores: vec![],
dummy_variable_rgx: None,
Expand Down Expand Up @@ -334,6 +342,7 @@ other-attribute = 1
"directory/also_excluded.py".to_string(),
],
select: None,
extend_select: vec![],
ignore: vec![],
per_file_ignores: vec![],
dummy_variable_rgx: None,
Expand Down
1 change: 1 addition & 0 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ impl Settings {
pyproject,
project_root,
};
settings.select(config.extend_select);
settings.ignore(&config.ignore);
Ok(settings)
}
Expand Down

0 comments on commit f80d5e7

Please # to comment.