-
Notifications
You must be signed in to change notification settings - Fork 64
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
Replace config.IsTestEnvironment with a configuration #10
Conversation
f065d95
to
ca3a1bb
Compare
1bb9133
to
717021a
Compare
ca3a1bb
to
cb84038
Compare
717021a
to
64b66ac
Compare
cb84038
to
cb1c20d
Compare
7456a3b
to
e92f4de
Compare
e92f4de
to
6990af9
Compare
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.
Overall looks good, but do we want a test specifically to test that setting this flag has some effect, even if we disable it for the majority of the test suite?
d6e0736
to
fe2b512
Compare
fe2b512
to
4db2508
Compare
Right, it's probably better to test it. I have added a non-parallel test to the test suite to test this functionality (since it needs to change the global |
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.
LGTM!
This PR removes the hardcoded `nolint:nilaway` docstring check for both files and function declarations since it is no longer necessary: * files: we have implemented configuration analyzer in #9 which is able to take a list of strings to ignore the analysis of a file. * function declaration: it is mainly designed for two reasons: * performance: we were able to use it to manually skip the analysis of a particular function for performance reasons. However, we now have a timeout for analysis of any particular function, hence this is no longer required. * error suppression: most linter drivers, especially nogo, are now respecting `nolint`, so there is really no need to support it within the linter itself. Depends on #10
// We specifically do not set this test to be parallel such that this test is run separately | ||
// from the parallel tests. This makes it possible to set the pretty-print flag to true for | ||
// testing and false for the other tests. |
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 is also documented here: https://pkg.go.dev/testing#T.Parallel
This PR replaces the global variable `config.IsTestEnvironment` with a user-configuration option `pretty-print` (default `true`). Then in our `TestMain` setup function we set this flag to be false for testing purposes. Depends on #9
This PR removes the hardcoded `nolint:nilaway` docstring check for both files and function declarations since it is no longer necessary: * files: we have implemented configuration analyzer in #9 which is able to take a list of strings to ignore the analysis of a file. * function declaration: it is mainly designed for two reasons: * performance: we were able to use it to manually skip the analysis of a particular function for performance reasons. However, we now have a timeout for analysis of any particular function, hence this is no longer required. * error suppression: most linter drivers, especially nogo, are now respecting `nolint`, so there is really no need to support it within the linter itself. Depends on #10
This PR replaces the global variable
config.IsTestEnvironment
with a user-configuration optionpretty-print
(defaulttrue
). Then in ourTestMain
setup function we set this flag to be false for testing purposes.Depends on #9