Skip to content

Conversation

@wmccrthy
Copy link
Contributor

@wmccrthy wmccrthy commented Feb 11, 2026

This PR implements two next steps for lute lint's configuration system: rule context and rule-specific ignores.

Context is a table of globals and rule specific options, as configured by the user. For example, given a configuration of:

{
...,
	globals = {
		myGlobal = 1
	},
	rules = {
		myRule = {
			options = {
				myOption = 1
			}
		}
	}
}

we will the following context to each call of myRule:

{
	globals = {
		myGlobal = 1
	},
	options = {
		myOption = 1
	}
}

This enables rule authors to write logic w/ configurability in mind, and extend their analyses to use-cases beyond the default.

Rule-specific ignores extend the global-lint ignores (implemented in this PR), but are evaluated per-rule. This enables more granular ignore behavior, where we can effectively turn off rules for certain files / paths.

wmccrthy and others added 30 commits February 5, 2026 13:00
@wmccrthy wmccrthy marked this pull request as ready for review February 11, 2026 21:42
@wmccrthy wmccrthy changed the title Support Passing Context thru to Lint Rules Lint Config: Support Passing Context thru to Rules Feb 11, 2026
lintRules: { types.LintRule },
autofixEnabled: boolean,
_lintConfig: types.LintConfig, -- will be used in follow-up PRs
lintConfig: types.LintConfig, -- will be used in follow-up PRs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lintConfig: types.LintConfig, -- will be used in follow-up PRs
lintConfig: types.LintConfig,

Comment on lines 233 to 238
local ruleConfig: types.RuleConfig = if rulesConfig[rule.name] ~= nil then rulesConfig[rule.name] else {}

local context: types.RuleContext = {
globals = if config.globals ~= nil then config.globals else {},
options = if ruleConfig.options ~= nil then ruleConfig.options else {},
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do this at the lintPaths level, instead of redoing it for every file

Copy link
Contributor Author

@wmccrthy wmccrthy Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move some of the derivation out for sure, but we'll need to pass thru globals and rule configs to this to lintString regardless, since I assume this is the level at which we'll do things like:

  • override violation severity w/ the configured severity
  • not run rules according to rule-specific ignores

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah sorry, i just meant we shouldn't do the computation of globals and options at this level

@wmccrthy wmccrthy requested a review from skberkeley February 12, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants