pub struct Config {
pub scan: ScanConfig,
pub watch: WatchConfig,
pub text_files: TextFilesConfig,
pub ignore: IgnoreConfig,
pub baseline: BaselineConfig,
pub severity: SeverityConfig,
pub disabled_rules: HashSet<String>,
pub rules: Vec<YamlRule>,
pub malware_signatures: Vec<MalwareSignature>,
}Expand description
Main configuration structure for cc-audit.
Fields§
§scan: ScanConfigScan configuration (CLI options).
watch: WatchConfigWatch mode configuration.
text_files: TextFilesConfigText file detection configuration.
ignore: IgnoreConfigIgnore configuration for scanning.
baseline: BaselineConfigBaseline configuration for drift detection.
severity: SeverityConfigRule severity configuration (v0.5.0).
disabled_rules: HashSet<String>Rule IDs to disable.
rules: Vec<YamlRule>Custom rules defined in config file.
malware_signatures: Vec<MalwareSignature>Custom malware signatures defined in config file.
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_file(path: &Path) -> Result<Self, ConfigError>
pub fn from_file(path: &Path) -> Result<Self, ConfigError>
Load configuration from a file.
Sourcepub fn find_config_file(project_root: Option<&Path>) -> Option<PathBuf>
pub fn find_config_file(project_root: Option<&Path>) -> Option<PathBuf>
Try to find a configuration file in the project directory or parent directories.
Returns None if no configuration file is found.
Search order:
- Walk up from project root to find
.cc-audit.yaml,.yml,.json, or.toml ~/.config/cc-audit/config.yaml
Sourcepub fn try_load(project_root: Option<&Path>) -> ConfigLoadResult
pub fn try_load(project_root: Option<&Path>) -> ConfigLoadResult
Try to load configuration from the project directory or global config. Returns both the configuration and the path where it was found.
Sourcepub fn load(project_root: Option<&Path>) -> Self
pub fn load(project_root: Option<&Path>) -> Self
Load configuration from the project directory or global config. Returns default configuration if no file is found.
Search order:
.cc-audit.yamlin project root.cc-audit.jsonin project root.cc-audit.tomlin project root~/.config/cc-audit/config.yaml- Default configuration
Source§impl Config
impl Config
Sourcepub fn generate_template() -> String
pub fn generate_template() -> String
Generate a YAML configuration template with comments.
Source§impl Config
impl Config
Sourcepub fn effective_disabled_rules(&self) -> HashSet<String>
pub fn effective_disabled_rules(&self) -> HashSet<String>
Get the effective set of disabled rules (merges severity.ignore and disabled_rules).
Sourcepub fn is_rule_disabled(&self, rule_id: &str) -> bool
pub fn is_rule_disabled(&self, rule_id: &str) -> bool
Check if a rule should be ignored based on both disabled_rules and severity.ignore.
Sourcepub fn get_rule_severity(&self, rule_id: &str) -> Option<RuleSeverity>
pub fn get_rule_severity(&self, rule_id: &str) -> Option<RuleSeverity>
Get the RuleSeverity for a rule, considering both severity config and disabled_rules.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more