pub struct HadolintConfig {
pub ignore_rules: HashSet<RuleCode>,
pub error_rules: HashSet<RuleCode>,
pub warning_rules: HashSet<RuleCode>,
pub info_rules: HashSet<RuleCode>,
pub style_rules: HashSet<RuleCode>,
pub allowed_registries: HashSet<String>,
pub label_schema: HashMap<String, LabelType>,
pub strict_labels: bool,
pub disable_ignore_pragma: bool,
pub failure_threshold: Severity,
pub no_fail: bool,
}Expand description
Configuration for the hadolint linter.
Fields§
§ignore_rules: HashSet<RuleCode>Rules to ignore entirely.
error_rules: HashSet<RuleCode>Rules to treat as errors (override default severity).
warning_rules: HashSet<RuleCode>Rules to treat as warnings (override default severity).
info_rules: HashSet<RuleCode>Rules to treat as info (override default severity).
style_rules: HashSet<RuleCode>Rules to treat as style (override default severity).
allowed_registries: HashSet<String>Allowed Docker registries (for DL3026).
label_schema: HashMap<String, LabelType>Label schema requirements (for DL3049-DL3056).
strict_labels: boolFail on labels not in schema.
disable_ignore_pragma: boolDisable inline ignore pragmas.
failure_threshold: SeverityMinimum severity to report.
no_fail: boolDon’t fail even if rules are violated.
Implementations§
Source§impl HadolintConfig
impl HadolintConfig
Sourcepub fn from_yaml_file(path: &Path) -> Result<Self, ConfigError>
pub fn from_yaml_file(path: &Path) -> Result<Self, ConfigError>
Load config from a YAML file.
Sourcepub fn from_yaml_str(yaml: &str) -> Result<Self, ConfigError>
pub fn from_yaml_str(yaml: &str) -> Result<Self, ConfigError>
Load config from a YAML string.
Sourcepub fn find_and_load() -> Option<Self>
pub fn find_and_load() -> Option<Self>
Find and load config from standard locations.
Search order:
- .hadolint.yaml in current directory
- .hadolint.yml in current directory
- XDG config directory
- Home directory
Sourcepub fn is_rule_ignored(&self, code: &RuleCode) -> bool
pub fn is_rule_ignored(&self, code: &RuleCode) -> bool
Check if a rule should be ignored.
Sourcepub fn effective_severity(&self, code: &RuleCode, default: Severity) -> Severity
pub fn effective_severity(&self, code: &RuleCode, default: Severity) -> Severity
Get the effective severity for a rule.
Sourcepub fn allow_registry(self, registry: impl Into<String>) -> Self
pub fn allow_registry(self, registry: impl Into<String>) -> Self
Builder method to add an allowed registry.
Sourcepub fn with_threshold(self, threshold: Severity) -> Self
pub fn with_threshold(self, threshold: Severity) -> Self
Builder method to set failure threshold.
Trait Implementations§
Source§impl Clone for HadolintConfig
impl Clone for HadolintConfig
Source§fn clone(&self) -> HadolintConfig
fn clone(&self) -> HadolintConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HadolintConfig
impl Debug for HadolintConfig
Auto Trait Implementations§
impl Freeze for HadolintConfig
impl RefUnwindSafe for HadolintConfig
impl Send for HadolintConfig
impl Sync for HadolintConfig
impl Unpin for HadolintConfig
impl UnwindSafe for HadolintConfig
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> 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