pub struct Config {
pub classification: ClassificationConfig,
pub weights: WeightsConfig,
pub limits: LimitsConfig,
pub output: OutputConfig,
}Expand description
Main configuration structure
Fields§
§classification: ClassificationConfigClassification settings
weights: WeightsConfigWeight settings
limits: LimitsConfigLimit settings
output: OutputConfigOutput settings
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_file(path: &Path) -> Result<Self, AppError>
pub fn from_file(path: &Path) -> Result<Self, AppError>
Loads configuration from a TOML file
§Arguments
path- Path to the configuration file
§Returns
Loaded configuration or error
§Errors
Returns error if file cannot be read or parsed
§Examples
use std::path::Path;
use rust_diff_analyzer::Config;
let config = Config::from_file(Path::new(".rust-diff-analyzer.toml"));Sourcepub fn test_features_set(&self) -> HashSet<&str>
pub fn test_features_set(&self) -> HashSet<&str>
Sourcepub fn should_ignore(&self, path: &Path) -> bool
pub fn should_ignore(&self, path: &Path) -> bool
Checks if an author should be ignored
§Arguments
author- Author name to check
§Returns
true if author is in the ignore list
§Examples
use rust_diff_analyzer::Config;
let mut config = Config::default();
config
.classification
.ignored_authors
.push("dependabot[bot]".to_string());
assert!(config.should_ignore_author("dependabot[bot]"));
assert!(!config.should_ignore_author("developer"));Sourcepub fn should_ignore_commit(&self, author: &str) -> bool
pub fn should_ignore_commit(&self, author: &str) -> bool
Checks if a commit should be ignored based on author
This method checks if the given author matches any of the ignored authors. It performs a substring match, so “github-actions[bot]” will match “github-actions[bot]” and “github-actions[bot]@users.noreply.github.com”.
§Arguments
author- Author string from git commit
§Returns
true if the commit author should be ignored
§Examples
use rust_diff_analyzer::Config;
let mut config = Config::default();
config
.classification
.ignored_authors
.push("dependabot".to_string());
assert!(config.should_ignore_author("dependabot[bot]"));Sourcepub fn is_test_path(&self, path: &Path) -> bool
pub fn is_test_path(&self, path: &Path) -> bool
Checks if a path is in a test directory
§Arguments
path- Path to check
§Returns
true if path is in a test directory
§Examples
use std::path::Path;
use rust_diff_analyzer::Config;
let config = Config::default();
assert!(config.is_test_path(Path::new("tests/integration.rs")));
assert!(!config.is_test_path(Path::new("src/lib.rs")));Sourcepub fn is_build_script(&self, path: &Path) -> bool
pub fn is_build_script(&self, path: &Path) -> bool
Checks if path is a build script
§Arguments
path- Path to check
§Returns
true if path is build.rs
§Examples
use std::path::Path;
use rust_diff_analyzer::Config;
let config = Config::default();
assert!(config.is_build_script(Path::new("build.rs")));
assert!(!config.is_build_script(Path::new("src/lib.rs")));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>,
Deserialize this value from the given Serde deserializer. Read more
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
Mutably borrows from an owned value. Read more