Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/signals/path-matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ const CONFIG_FILE_NAMES: ReadonlySet<string> = new Set([
".gitignore",
".gitattributes",
".dockerignore",
// Dependency automation and local toolchain version pins.
"renovate.json",
"dependabot.yml",
".tool-versions",
"mise.toml",
"lefthook.yml",
"lefthook.yaml",
".pre-commit-config.yaml",
// Hosted CI pipeline definitions (single-file basenames).
".gitlab-ci.yml",
"azure-pipelines.yml",
"buf.yaml",
"buf.gen.yaml",
]);

// Filename prefixes that identify build, lint, test-runner, and environment config files.
Expand Down Expand Up @@ -145,9 +158,12 @@ export function isDependencyManifestFile(path: string): boolean {
* lower-effort than genuine source changes, so slop signals can weight them differently (#561).
*/
export function isConfigFile(path: string): boolean {
const norm = normalize(path);
const base = basename(path);
if (CONFIG_FILE_NAMES.has(base)) return true;
if (CONFIG_FILE_PREFIXES.some((prefix) => base.startsWith(prefix))) return true;
if (/(^|\/)\.github\/workflows\/[^/]+\.(ya?ml)$/.test(norm)) return true;
if (/(^|\/)\.circleci\/config\.ya?ml$/.test(norm)) return true;
if (/\.(config|rc)\.[a-z0-9]+$/i.test(base)) return true;
// `.stylelintrc`-style: dot-prefixed name with no extension after "rc"; `custom.rc`: dotted rc extension.
return base.endsWith(".rc") || /^\.[^.]+rc$/i.test(base);
Expand Down
28 changes: 28 additions & 0 deletions test/unit/path-matchers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,32 @@ describe("isConfigFile", () => {
}
});

it("matches automation, toolchain, and hosted CI config files", () => {
for (const path of [
"renovate.json",
".github/dependabot.yml",
".tool-versions",
"mise.toml",
"lefthook.yml",
".pre-commit-config.yaml",
".gitlab-ci.yml",
"azure-pipelines.yml",
"buf.yaml",
"buf.gen.yaml",
".github/workflows/ci.yml",
".github/workflows/release.yaml",
".circleci/config.yml",
]) {
expect(isConfigFile(path)).toBe(true);
}
});

it("does not treat renovate-like source names as config", () => {
for (const path of ["src/renovate-helpers.ts", "docs/dependabot-notes.md"]) {
expect(isConfigFile(path)).toBe(false);
}
});

it("matches config files by known filename prefix", () => {
for (const path of ["tsconfig.build.json", "vitest.config.ts", ".env.local", ".eslintrc.json", ".prettierrc.js"]) {
expect(isConfigFile(path)).toBe(true);
Expand Down Expand Up @@ -212,6 +238,8 @@ describe("classifyChangedFile", () => {
["vitest.config.ts", "config"],
["wrangler.jsonc", "config"],
["turbo.json", "config"],
["renovate.json", "config"],
[".github/workflows/ci.yml", "config"],
["test/unit/app.test.ts", "test"],
["README.md", "docs"],
["src/app.ts", "source"],
Expand Down
Loading