-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Add testpackage linter #156
Conversation
Enforces a consistent test package layout. This makes it difficult to test internal functionality, which I believe promotes healthy decomposition, and minimal package exports.
Codecov Report
@@ Coverage Diff @@
## main #156 +/- ##
==========================================
+ Coverage 66.62% 66.99% +0.37%
==========================================
Files 103 103
Lines 5129 5129
Branches 68 68
==========================================
+ Hits 3417 3436 +19
+ Misses 1396 1380 -16
+ Partials 316 313 -3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it difficult to test internal functionality, which I believe promotes healthy decomposition
Agree 100%! LGTM, thanks for bringing this in
@@ -1,6 +1,6 @@ | |||
//go:build linux | |||
|
|||
package terraform | |||
package terraform_test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally like this approach, since it means the tests are done against the externally-visible functions. Sometimes I personally have tests where I want to poke at the internals, and I'm never sure if I should be exporting those functions (e.g. a package that provides an exported func A, which invokes some small internal helpers B and C; I like to have tests for all of them, in which case I'd have both a _test
and non-_test
package)
I see that this tool skips packages named XXX_internal_test.go
by convention, which makes things clearer even in the case where we want to look at the internals.
Nice change! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love enforcing these conventions. Consistency is key!
Enforces a consistent test package layout.
This makes it difficult to test internal
functionality, which I believe promotes
healthy decomposition, and minimal package
exports.