LintConfig

Struct LintConfig 

Source
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: ColorConfig

Color output settings.

§parser: ParserConfig

Parser-level settings (e.g. additional block directives for extension modules).

§include: IncludeConfig

Include resolution settings (e.g. path mappings for include directives).

Implementations§

Source§

impl LintConfig

Source

pub const DISABLED_BY_DEFAULT: &'static [&'static str]

Rules that are disabled by default

Source

pub fn from_file(path: &Path) -> Result<Self, ConfigError>

Load configuration from a file

Source

pub fn parse(content: &str) -> Result<Self, String>

Parse configuration from a TOML string

Source

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.

Source

pub fn is_rule_enabled(&self, name: &str) -> bool

Check if a rule is enabled

Source

pub fn get_rule_config(&self, name: &str) -> Option<&RuleConfig>

Get the configuration for a specific rule

Source

pub fn color_mode(&self) -> ColorMode

Get the color mode setting

Source

pub fn additional_block_directives(&self) -> &[String]

Get additional block directives from config

Source

pub fn include_path_mappings(&self) -> &[PathMapping]

Get include path mappings (applied in order to include patterns before resolving)

Source

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.

Source

pub fn include_prefix(&self) -> Option<&str>

Get include prefix (base directory for resolving relative include paths)

Source

pub fn additional_contexts(&self) -> Option<&HashMap<String, Vec<String>>>

Get additional contexts for invalid-directive-context rule

Source

pub fn directive_inheritance_excluded(&self) -> Option<&[String]>

Get excluded directives for directive-inheritance rule

Source

pub fn directive_inheritance_additional(&self) -> Option<&[AdditionalDirective]>

Get additional directives for directive-inheritance rule

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LintConfig

Source§

fn default() -> LintConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for LintConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for LintConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,