-
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
Add a NilAway config analyzer for parsing and sharing configurations #9
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yuxincs
commented
Jul 25, 2023
"strings" | ||
"time" |
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.
The non-user-configurable "configs" are moved to another file const.go
in this package
lazaroclapp
approved these changes
Jul 25, 2023
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.
All LGTM 🙂
yuxincs
force-pushed
the
yuxincs/add-config-analyzer
branch
from
July 26, 2023 15:41
f198d73
to
f065d95
Compare
This was referenced Jul 26, 2023
yuxincs
force-pushed
the
yuxincs/add-config-analyzer
branch
2 times, most recently
from
July 29, 2023 03:03
ca3a1bb
to
cb84038
Compare
yuxincs
force-pushed
the
yuxincs/add-linting
branch
from
July 29, 2023 03:03
422ab53
to
e425c4d
Compare
yuxincs
force-pushed
the
yuxincs/add-config-analyzer
branch
3 times, most recently
from
July 31, 2023 19:44
0c3b964
to
5606a36
Compare
…among NilAway sub-analyzers
yuxincs
force-pushed
the
yuxincs/add-config-analyzer
branch
from
July 31, 2023 19:51
5606a36
to
76f4078
Compare
yuxincs
added a commit
that referenced
this pull request
Aug 4, 2023
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
yuxincs
added a commit
that referenced
this pull request
Aug 4, 2023
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
sonalmahajan15
pushed a commit
that referenced
this pull request
Aug 5, 2023
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
sonalmahajan15
pushed a commit
that referenced
this pull request
Aug 5, 2023
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a separate psudo-analyzer for getting the flags and sharing them among the NilAway sub-analyzers.
This is required due to our multi-sub-analyzer architecture in NilAway: by the time the top-level analyzer is run, the analysis is already done (by the sub-analyzers), hence the flags controlling the analysis behaviors will be meaningless. Instead, we add this pseudo-analyzer to run first (since all sub-analyzers will depend on it), and make the flags available via its return value.
Unfortunately, this also means for some analyzer drivers (such as nogo), flags will have to be specified for this pseudo-analyzer ("nilaway_config"), and the error suppression lists will have to be specified for the top-level analyzer ("nilaway") since that is the one that outputs errors.
Two test packages
ignoredpkg1
andignoredpkg2
are added to ensure the flags are properly parsed and shared by the sub-analyzers.This PR also adds an early-return logic for the accumulation analyzer: previously even if a package is skipped, we were still unnecessarily running the accumulation analyzer to "get" the empty results from sub-analyzers and run the inference.
Depends on #7