Skip to content

fix(categorize): recognise Go, Python and Ruby test files - #66

Merged
jpbelmo merged 3 commits into
Redential:mainfrom
Arunendra21:fix-categorize-multilang-test-files
Aug 10, 2026
Merged

fix(categorize): recognise Go, Python and Ruby test files#66
jpbelmo merged 3 commits into
Redential:mainfrom
Arunendra21:fix-categorize-multilang-test-files

Conversation

@Arunendra21

Copy link
Copy Markdown
Contributor

Bug

categorize (src/categorize.ts) only recognises JS/TS test conventions in its "testing" rule (a test//spec/ directory or the .test./.spec. infix). Test files from other languages fall through to the "backend" rule and are miscategorised:

categorize("foo_test.go")   // "backend"  (Go)
categorize("test_user.py")  // "backend"  (Python)
categorize("user_spec.rb")  // "backend"  (Ruby)

Go's _test.go in particular is a hard convention, so every Go test file is currently counted as backend, which inflates "backend" and undercounts "testing".

Fix

Extend the "testing" rule to also match the _test./_spec. suffix (Go, Ruby, and others) and the Python test_ prefix, across any file extension. Existing JS/TS matches are unchanged.

Tests

Added test/categorize.test.ts covering the JS/TS, Go, Python and Ruby cases, and guarding against false positives such as latest.go and contest.py, which stay "backend".

The "testing" rule only matched JS/TS conventions (a test/spec directory
or the `.test.`/`.spec.` infix), so `foo_test.go` (Go), `test_foo.py`
(Python) and `foo_spec.rb` (Ruby) fell through to the "backend" rule and
were miscategorised. Extend the rule to also match the `_test.`/`_spec.`
suffix and the `test_` prefix, across any file extension.

Adds tests for categorize covering the new cases and guarding against
false positives such as `latest.go` and `contest.py`.
@jpbelmo

jpbelmo commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Welcome, and thanks for a great first contribution. Correct diagnosis, tight fix, and you brought tests for a module that had none dedicated to it. The false-positive guards (latest.go, contest.py) are exactly the kind of care this repo runs on.

Verified locally: full suite green on your branch, typecheck clean.

One thing before merge: every change here ships with a CHANGELOG.md entry (Keep a Changelog format). Can you add one under ## [Unreleased], section ### Fixed? Something like: "Go (foo_test.go), Python (test_foo.py) and Ruby (foo_spec.rb) test files are now categorised as testing instead of falling through to backend."

Small heads-up, no action needed: your suffix rule is broader than the title says (_test./_spec. now match any extension, and test_* files win over the devops rule since testing runs first). That's fine by us, categories are heuristics and the wins outweigh the edges. Just noting it so the behavior is on the record.

@jpbelmo

jpbelmo commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the changelog entry, and nice to see the assist from @eeshsaxena. One mechanical thing: that commit converted the whole CHANGELOG.md to CRLF line endings, so the diff rewrites all 1000+ lines instead of adding 5. Can you re-save it with LF endings (the repo's format) so the diff is just your new entry? git config core.autocrlf input before amending usually does it. After that this is ready to merge from my side.

@Arunendra21
Arunendra21 force-pushed the fix-categorize-multilang-test-files branch from c4d6721 to 1a87700 Compare August 9, 2026 09:19
@Arunendra21

Copy link
Copy Markdown
Contributor Author

Thanks for the careful review, and good catch on the line endings. That was my editor rewriting the whole file as CRLF. I have re-saved CHANGELOG.md with LF endings to match the repo, so the diff is now just the five added lines for the Unreleased entry. The categorize fix and tests are unchanged.

@jpbelmo
jpbelmo merged commit bbc1938 into Redential:main Aug 10, 2026
7 checks passed
@jpbelmo

jpbelmo commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Merged. Welcome to the contributor list — first PR with a real bug, a correct fix, honest false-positive guards, and the repo's first dedicated categorize test file. Go test files finally count as what they are. Hope to see you around for another one.

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