mirror of
https://github.com/addyosmani/agent-skills.git
synced 2026-10-26 15:05:04 +00:00
fix(constraints): say that threshold-removed can mean a number changed its direction words
Follow-up from the review on #600 (@abhisheksharma2411): a number that gains or loses its direction words (">= 80%" becoming "80%", or the reverse) is paired within its direction and so reads as removed. That is kept on purpose, since the rule changed shape and a person should look once, but the output now says so, as it already does for a renamed rule, so the finding is not read as a literal deletion. One case added for a minimum losing its direction words: 22 pass, and the new case fails without the message.
This commit is contained in:
1 parent
23f205295a
commit
c1a5cf43de
2 files changed
+12
No files matched your search
@@ -199,3 +199,12 @@ test('floor guard: a renamed rule is reported as removed, with a note that its l
|
||||
assert.match(result.stderr, /\[rule-removed\]/);
|
||||
assert.match(result.stderr, /label changed/);
|
||||
});
|
||||
|
||||
test('floor guard: a threshold that loses its direction words is reported as removed, with a note saying so', () => {
|
||||
const root = makeRepo();
|
||||
editConstraints(root, '| Coverage | >= 80% |', '| Coverage | 80% |');
|
||||
const result = runGuard(root);
|
||||
assert.equal(result.status, 1, result.stderr);
|
||||
assert.match(result.stderr, /\[threshold-removed\]/);
|
||||
assert.match(result.stderr, /direction words/);
|
||||
});
|
||||
@@ -154,6 +154,9 @@ for (const f of findings) console.error(` [${f.rule}] ${f.file}: ${f.text}`);
|
||||
if (findings.some((f) => f.rule === 'rule-removed')) {
|
||||
console.error('\nA rule-removed finding can also mean the rule\'s label changed: rename a rule in one commit and change its thresholds in another.');
|
||||
}
|
||||
if (findings.some((f) => f.rule === 'threshold-removed')) {
|
||||
console.error('\nA threshold-removed finding can also mean a number gained or lost its direction words (">= 80%" becoming "80%", or the reverse): compare the two lines before assuming a threshold was deleted.');
|
||||
}
|
||||
console.error('\nEach is a move that lowers the bar. Fix the code, or route it through a tracked exception.');
|
||||
process.exit(1);
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user