Repository navigation
feat: exempt one paragraph from density, and turn a lint off in an override - #273
Merged
Merged
Conversation
…erride Two changes for #68. A density entry in `allow` now names one paragraph or list item. Its quote is the whole block, folded like a sentence quote, so any edit to the block makes the entry stale and the block is judged again. Failed entries report no_such_block, two_blocks or no_finding. fix leaves a block that an entry quotes as it is. An override takes `off = ["<lint>", ...]`, which sets each named lint back to unset for the files it matches. A later override that sets the lint's table turns it on again with only what that table sets. Load refuses an unknown lint, a lint named twice, a lint the same override also sets, and a lint no table of the section turns on. `deslag explain` shows `# <lint>: off, by override N`. The guide no longer says an override cannot turn a lint off. Only a human writes an entry or an off. The summary line, the SARIF rule and the docs of an entry now speak of text, not only of a sentence, since an entry can name a paragraph.
webern
force-pushed
the
claude/compassionate-edison-uv3gwa
branch
from
November 29, 2026 15:23
7cf1142 to
9153378
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human Summary
This gives the user the ability to exempt a single lint case.
Summary
Issue #68 asked for two things. The first is a way to exempt one violation, keyed to its place and not to the whole file. The second is a way for a narrower override to turn off a lint that a broader override turned on.
Much of the first already exists.
[[<section>.allow]]entries (#199, #251) exempt one sentence, they require a reason, a tally of them prints on every run, and a stale entry fails the check.list_growth, the lint behind #67, was removed in #207, so there was no list count to rebase. What was still missing:densitycould not be exempted. Anallowentry fordensitynow quotes one whole paragraph or list item, folded the same way a sentence quote is. Any edit to that block makes the entry stale, and the block is judged again. So a paragraph that grows has to be re-exempted by a human, and an entry does not last forever. A failed entry reportsno_such_block,two_blocksorno_finding.deslag fixleaves a quoted block as it is. Alineon adensityentry is refused.off = ["<lint>", ...]. This sets each named lint back to unset for the files the override matches. A later override that sets the lint's table turns it back on, with only the settings that table sets. Loading the config (exit 2) refuses an unknown lint, a lint named twice, a lint the same override both turns off and sets, and anofffor a lint that no table in the section turns on.deslag explainshows# <lint>: off, by override N. The field is markedsince = "next"with a default of[], so it needs no schema version bump.Exemptions stay in the config, with no in-file marker. That keeps to the existing rule that there is one way to exempt a finding.
guide.mdandlints/allow.mdno longer say that an override cannot turn a lint off, or that an entry only exempts a sentence. They keep the rule that an agent proposes an entry or anoffand a human writes it. The summary line, the SARIF rule text and the docs for entries now say "text" rather than "sentence", since an entry can name a paragraph..agents/deslag.tomlis unchanged. The #67 workaround was already removed along withlist_growth.Testing
make ci-fast: exit 0, includingcheck-deslagon the repo itselfmake test-tools: exit 0densitycases:override_off,allow_applied,allow_fails(coveringno_such_blockandno_finding),allow_rustandallow_fix_heldoffload errors, the merge order andtwo_blocks, plus a newdeslag explaintestmake fix-test-output, and the diff checked. Existingdensitycases changed only by the added advice sentence and the sentence-to-text wording.References