Make setting and retrieving pydocstyle settings less tedious (#12582)

This commit is contained in:
Alex Waygood 2024-07-31 10:39:33 +01:00 committed by GitHub
parent 138e70bd5c
commit 83b1c48a93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 146 additions and 134 deletions

View file

@ -1,5 +1,3 @@
use std::collections::BTreeSet;
use regex::Regex;
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
use serde::{Deserialize, Serialize};
@ -2762,11 +2760,16 @@ pub struct PydocstyleOptions {
impl PydocstyleOptions {
pub fn into_settings(self) -> pydocstyle::settings::Settings {
pydocstyle::settings::Settings {
convention: self.convention,
ignore_decorators: BTreeSet::from_iter(self.ignore_decorators.unwrap_or_default()),
property_decorators: BTreeSet::from_iter(self.property_decorators.unwrap_or_default()),
}
let PydocstyleOptions {
convention,
ignore_decorators,
property_decorators,
} = self;
pydocstyle::settings::Settings::new(
convention,
ignore_decorators.unwrap_or_default(),
property_decorators.unwrap_or_default(),
)
}
}