pub struct Config {Show 20 fields
pub languages: HashSet<String>,
pub includes: Vec<String>,
pub excludes: Vec<String>,
pub max_complexity: Option<u32>,
pub preset: Option<String>,
pub verbose: Option<bool>,
pub source: Option<SourceConfig>,
pub language_overrides: LanguageOverrides,
pub plugins: Option<PluginConfig>,
pub plugin_auto_sync: Option<AutoSyncConfig>,
pub self_auto_update: Option<SelfUpdateConfig>,
pub tool_auto_install: Option<ToolAutoInstallConfig>,
pub performance: PerformanceConfig,
pub hook: HookConfig,
pub cmsg: CmsgConfig,
pub rules: RulesConfig,
pub ai: AiConfig,
pub review: ReviewConfig,
pub retention: RetentionConfig,
pub checks: ChecksConfig,
}Expand description
Main configuration structure for linthis.
Contains all configuration options for controlling lint behavior, formatting, language-specific settings, and plugin configuration.
§Example
use linthis::config::Config;
use std::path::Path;
// Load from project directory
let config = Config::load_merged(Path::new("."));
// Access configuration values
println!("Max complexity: {:?}", config.max_complexity);
println!("Excluded patterns: {:?}", config.excludes);Fields§
§languages: HashSet<String>Languages to check (empty = auto-detect)
includes: Vec<String>Paths/patterns to include (glob patterns)
excludes: Vec<String>Paths/patterns to exclude (glob patterns)
max_complexity: Option<u32>Maximum cyclomatic complexity allowed
preset: Option<String>Format preset to use (google, standard, airbnb)
verbose: Option<bool>Verbose output
source: Option<SourceConfig>Source configuration (compatible with CodeCC .code.yml)
language_overrides: LanguageOverridesLanguage-specific overrides (flattened to root level)
plugins: Option<PluginConfig>Plugin configuration
plugin_auto_sync: Option<AutoSyncConfig>Plugin auto-sync configuration
self_auto_update: Option<SelfUpdateConfig>Self auto-update configuration
tool_auto_install: Option<ToolAutoInstallConfig>Tool auto-install configuration
performance: PerformanceConfigPerformance settings
hook: HookConfigHook settings
cmsg: CmsgConfigCommit message validation settings
rules: RulesConfigCustom rules, rule disable, and severity overrides
ai: AiConfigAI configuration for fix suggestions
review: ReviewConfigCode review settings
retention: RetentionConfigRetention settings for results, backups, reviews, and cache
checks: ChecksConfigChecks configuration: which checks to run and per-check settings.
[checks]
run = ["lint"] # default: only lint
# run = ["lint", "security", "complexity"] # enable all
[checks.security]
scan_type = "sast"
fail_on = "high"
[checks.complexity]
threshold = 15Implementations§
Source§impl Config
impl Config
Sourcepub fn built_in_defaults() -> Self
pub fn built_in_defaults() -> Self
Load built-in default configuration
Sourcepub fn load_user_config() -> Option<Self>
pub fn load_user_config() -> Option<Self>
Load user-level configuration from ~/.linthis/config.toml
Sourcepub fn load_project_config(start_dir: &Path) -> Option<Self>
pub fn load_project_config(start_dir: &Path) -> Option<Self>
Load project-level configuration from the given directory Searches for .linthis/config.toml in the start directory and parent directories
Sourcepub fn merge(&mut self, other: Config)
pub fn merge(&mut self, other: Config)
Merge another configuration into this one.
Values from other override values in self.
Sourcepub fn get_plugin_sources(&self) -> Vec<PluginSource>
pub fn get_plugin_sources(&self) -> Vec<PluginSource>
Get plugin sources from config, converting to PluginSource type
Sourcepub fn load_merged(project_dir: &Path) -> Self
pub fn load_merged(project_dir: &Path) -> Self
Load and merge configuration from all sources with proper precedence.
Priority chain (lowest to highest): built-in defaults → global plugin linthis.toml (from plugins in ~/.linthis/config.toml) → project plugin linthis.toml (from plugins in .linthis/config.toml) → ~/.linthis/config.toml (user config — overrides plugin) → .linthis/config.toml (project config — highest)
Sourcepub fn get_active_config_paths(project_dir: &Path) -> Vec<PathBuf>
pub fn get_active_config_paths(project_dir: &Path) -> Vec<PathBuf>
Return the ordered list of config file paths that are actually loaded
by [load_merged], from lowest to highest priority.
Only paths that exist on disk are included. Built-in defaults have no file path and are therefore not listed.
Sourcepub fn generate_default_toml() -> String
pub fn generate_default_toml() -> String
Generate a default configuration file content
Sourcepub fn project_config_path(project_dir: &Path) -> PathBuf
pub fn project_config_path(project_dir: &Path) -> PathBuf
Get the path for a new project config file
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,
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