pub struct LintConfig {
pub rules: HashMap<String, RuleConfig>,
pub color: ColorConfig,
pub parser: ParserConfig,
pub include: IncludeConfig,
}Expand description
Configuration for nginx-lint loaded from .nginx-lint.toml.
Use from_file to load from a specific path, or
find_and_load to search the directory tree upward.
A default LintConfig enables all rules except those listed in
DISABLED_BY_DEFAULT.
Fields§
§rules: HashMap<String, RuleConfig>Per-rule configuration keyed by rule name (e.g. "indent", "server-tokens-enabled").
color: ColorConfigColor output settings.
parser: ParserConfigParser-level settings (e.g. additional block directives for extension modules).
include: IncludeConfigInclude resolution settings (e.g. path mappings for include directives).
Implementations§
Source§impl LintConfig
impl LintConfig
Sourcepub const DISABLED_BY_DEFAULT: &'static [&'static str]
pub const DISABLED_BY_DEFAULT: &'static [&'static str]
Rules that are disabled by default
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_and_load(dir: &Path) -> Option<(Self, PathBuf)>
pub fn find_and_load(dir: &Path) -> Option<(Self, PathBuf)>
Find and load .nginx-lint.toml from the given directory or its parents.
Returns the loaded config along with the path of the config file found.
Sourcepub fn is_rule_enabled(&self, name: &str) -> bool
pub fn is_rule_enabled(&self, name: &str) -> bool
Check if a rule is enabled
Sourcepub fn get_rule_config(&self, name: &str) -> Option<&RuleConfig>
pub fn get_rule_config(&self, name: &str) -> Option<&RuleConfig>
Get the configuration for a specific rule
Sourcepub fn color_mode(&self) -> ColorMode
pub fn color_mode(&self) -> ColorMode
Get the color mode setting
Sourcepub fn additional_block_directives(&self) -> &[String]
pub fn additional_block_directives(&self) -> &[String]
Get additional block directives from config
Sourcepub fn include_path_mappings(&self) -> &[PathMapping]
pub fn include_path_mappings(&self) -> &[PathMapping]
Get include path mappings (applied in order to include patterns before resolving)
Sourcepub fn json_schema() -> Value
pub fn json_schema() -> Value
Generate the JSON Schema for the configuration file.
The schema is derived from the Rust type definitions, so it automatically stays in sync with the actual configuration structure.
Sourcepub fn include_prefix(&self) -> Option<&str>
pub fn include_prefix(&self) -> Option<&str>
Get include prefix (base directory for resolving relative include paths)
Sourcepub fn additional_contexts(&self) -> Option<&HashMap<String, Vec<String>>>
pub fn additional_contexts(&self) -> Option<&HashMap<String, Vec<String>>>
Get additional contexts for invalid-directive-context rule
Sourcepub fn directive_inheritance_excluded(&self) -> Option<&[String]>
pub fn directive_inheritance_excluded(&self) -> Option<&[String]>
Get excluded directives for directive-inheritance rule
Sourcepub fn directive_inheritance_additional(&self) -> Option<&[AdditionalDirective]>
pub fn directive_inheritance_additional(&self) -> Option<&[AdditionalDirective]>
Get additional directives for directive-inheritance rule
Sourcepub fn validate_file(path: &Path) -> Result<Vec<ValidationError>, ConfigError>
pub fn validate_file(path: &Path) -> Result<Vec<ValidationError>, ConfigError>
Validate a configuration file and return any errors
Trait Implementations§
Source§impl Debug for LintConfig
impl Debug for LintConfig
Source§impl Default for LintConfig
impl Default for LintConfig
Source§fn default() -> LintConfig
fn default() -> LintConfig
Source§impl<'de> Deserialize<'de> for LintConfig
impl<'de> Deserialize<'de> for LintConfig
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>,
Source§impl JsonSchema for LintConfig
impl JsonSchema for LintConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more