pub struct Configuration {
pub ignore: HashSet<String>,
pub max_db_age_days: Option<u64>,
pub ignore_comments: HashMap<String, String>,
}Expand description
Configuration loaded from a .gem-audit.yml file.
Fields§
§ignore: HashSet<String>Advisory IDs to ignore during scanning.
max_db_age_days: Option<u64>Maximum database age in days before warning.
ignore_comments: HashMap<String, String>Inline comments parsed from the YAML file (advisory ID → comment text).
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub const DEFAULT_FILE: &str = ".gem-audit.yml"
pub const DEFAULT_FILE: &str = ".gem-audit.yml"
The default configuration file name.
Sourcepub const LEGACY_FILE: &str = ".bundler-audit.yml"
pub const LEGACY_FILE: &str = ".bundler-audit.yml"
Legacy configuration file name for backward compatibility.
Sourcepub fn load(path: &Path) -> Result<Self, ConfigError>
pub fn load(path: &Path) -> Result<Self, ConfigError>
Load configuration from a YAML file.
Returns an error if the file exists but contains invalid content.
Sourcepub fn load_or_default(path: &Path) -> Result<Self, ConfigError>
pub fn load_or_default(path: &Path) -> Result<Self, ConfigError>
Load configuration from a YAML file path, returning a default configuration if the file does not exist.
When the primary path does not exist and its file name matches the
default (.gem-audit.yml), the legacy name (.bundler-audit.yml)
is tried in the same directory for backward compatibility.
Sourcepub fn save(
&self,
path: &Path,
comments: Option<&HashMap<String, String>>,
) -> Result<(), ConfigError>
pub fn save( &self, path: &Path, comments: Option<&HashMap<String, String>>, ) -> Result<(), ConfigError>
Save configuration to a YAML file.
Writes the ignore list and optional max_db_age_days in a stable,
sorted order so that diffs are minimal across runs.
An optional comments map can annotate each advisory ID with context
(e.g. gem name, version, criticality).
Sourcepub fn from_yaml(yaml: &str) -> Result<Self, ConfigError>
pub fn from_yaml(yaml: &str) -> Result<Self, ConfigError>
Parse configuration from a YAML string.
Trait Implementations§
Source§impl Clone for Configuration
impl Clone for Configuration
Source§fn clone(&self) -> Configuration
fn clone(&self) -> Configuration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more