Setting the entire file AST as the node causes golangci-lint to print
the entire file source as the context, and line and column numbers set
to 1. Point to the package name node instead.
Closes#688
* Fixes issue #619 imports-blacklist support regex
* refactors method name and error message
* restores original test cases
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
Noticed during migration from our heavily modified "go-lint" to "revive" that there is an additional line printed. I am unsure that the convention for this project is on this, we do not allow adding such a call.
* Separating lib from cli
* Renamed NewRevive to New
* Added GetLintFailures helper function
* Moved formatter to call to format since that's when it's needed
* makes fields of Revive struct non-public
* minor modifs in tests: remove unnamed constats
* Added lint package management to lint command
* README message for using revive as a library
* README formatting
* Removed unused method
* Slightly improved wording in README
* Handling format errors
* Renaming file to better reflect intent
* Refactoring pattern usage
* README heads
* renames excludePaths into excludePatterns
Co-authored-by: Bernardo Heynemann <bernardo.heynemann@coinbase.com>
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
This change allows revive to be called from main.go
in other libraries and pass in a list of custom
linters to be added to the built-in linters found in config
Co-authored-by: Bernardo Heynemann <bernardo.heynemann@coinbase.com>
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
* Allow a whitelist for the context parameter check
This allows users to configure a set of types that may appear before
`context.Context`.
Notably, I think this rule is useful for allowing the `*testing.T` type
to come before `context.Context`, though there may be other uses (such
as putting a tracer before it, etc).
See #605 for a little more context on this.
Fixes#605
* Save a level of indentation in context-as-arg validation
We can unindent if we make the above check more specific
* refactoring taking into account chavacava's review
Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>