passsy / no-conventional-commitsr2
Avoid Conventional Commits
PublicDescribe what changed and why in the commit subject instead of prefixing it with feat:, fix: or chore:, which add noise the diff already shows.
tests, run by the registry11 passed · slowest 2.8 ms
- The advice links to www.conventionalcommits.org
✓fires2.8 ms
fires on a prefixed subject: $line ({"line":"git add lib/auth.dart && git commit -m \"feat(auth): add passkey login\"","subject":"feat(auth): add passkey login"})
commandfired: "feat(auth): add passkey login"
git add lib/auth.dart && git commit -m "feat(auth): add passkey login"✓fires1.0 ms
fires on a prefixed subject: $line ({"line":"git commit --message='fix: crash on empty cart'","subject":"fix: crash on empty cart"})
commandfired: "fix: crash on empty cart"
git commit --message='fix: crash on empty cart'✓fires0.9 ms
fires on a prefixed subject: $line ({"line":"git commit -m \"fix: Explain the change\"","subject":"fix: Explain the change"})
commandfired: "fix: Explain the change"
git commit -m "fix: Explain the change"✓fires0.9 ms
fires on a prefixed subject: $line ({"line":"git commit -m \"chore!: drop Dart 2 support\"","subject":"chore!: drop Dart 2 support"})
commandfired: "chore!: drop Dart 2 support"
git commit -m "chore!: drop Dart 2 support"✓fires0.8 ms
fires on the subject of a heredoc message
commandfired: "docs: explain the sync engine"
git commit -m "$(cat <<'EOF'
docs: explain the sync engine
The body.
EOF
)"✓quiet0.8 ms
stays quiet on git commit -m "Add passkey login"
commandstayed quiet
git commit -m "Add passkey login"✓quiet0.8 ms
stays quiet on git commit -m "Router: stop dropping the query string"
commandstayed quiet
git commit -m "Router: stop dropping the query string"✓quiet0.8 ms
stays quiet on echo "feat: this is not a commit" && git status
commandstayed quiet
echo "feat: this is not a commit" && git status✓quiet0.8 ms
stays quiet on git log --oneline
commandstayed quiet
git log --oneline✓fires1.7 ms
points at the principle when the user mentions conventional commits
promptfired: "conventional commits"
Should we switch to conventional commits?✓quiet1.7 ms
stays quiet on a prompt about commits in general
promptstayed quiet
What are the last three commits about?detector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { command, detect, prompt } from "@wellactually/sdk/v3/test";
test.each([
{ line: `git add lib/auth.dart && git commit -m "feat(auth): add passkey login"`, subject: "feat(auth): add passkey login" },
{ line: `git commit --message='fix: crash on empty cart'`, subject: "fix: crash on empty cart" },
{ line: `git commit -m "fix: Explain the change"`, subject: "fix: Explain the change" },
{ line: `git commit -m "chore!: drop Dart 2 support"`, subject: "chore!: drop Dart 2 support" },
])("fires on a prefixed subject: $line", ({ line, subject }) => {
expect(detect(command(line))).toEqual([{ match: subject }]);
});
test("fires on the subject of a heredoc message", () => {
const line = `git commit -m "$(cat <<'EOF'\ndocs: explain the sync engine\n\nThe body.\nEOF\n)"`;
expect(detect(command(line))).toEqual([{ match: "docs: explain the sync engine" }]);
});
test.each([
`git commit -m "Add passkey login"`,
`git commit -m "Router: stop dropping the query string"`,
`echo "feat: this is not a commit" && git status`,
`git log --oneline`,
])("stays quiet on %s", (line) => {
expect(detect(command(line))).toEqual([]);
});
test("points at the principle when the user mentions conventional commits", () => {
expect(detect(prompt("Should we switch to conventional commits?"))).toEqual([{ match: "conventional commits", depth: "pointer" }]);
});
test("stays quiet on a prompt about commits in general", () => {
expect(detect(prompt("What are the last three commits about?"))).toEqual([]);
});