* fix error return rule to allow multiple error return values
please check golint related updates here: golang/lint@8379672
When returning multiple values with an error,
lint checks if the error is the last return value.
But the implementation actually is checking for all return values
except for the last one, and throw the alert if it found an error.
There is a (edge) case where some function returning more than one error
is getting a false positive even when the last return value is an error.
This patch adds an early check, to see if the last return value is an error
and if so, it will pass silently.
* Fix return error
* add test changes
* New rule: line-length-limit
* simplify the panic message of rule line-length-limit
* Refactors `line-length-limit` rule, use private `check` method instead of `Visit`
* Refactoring on atomic rule:
-Main modification: move func gofmt to utils.go
* Refactoring on constant-logical-expr rule
Simplifies equality check of subexpressions by using gofmt function
* Add the imports-blacklist rule with tests
* Add the imports-blacklist rule to README.md
* Update the imports-blacklist rule to use map[string]bool so that we can have the algorithm in Visit below with O(n) instead of O(n*m)
* Fix the imports-blacklist rule to be case sensitive
This PR introduces a white & black lists of initialisms for the
`var-naming` rule.
Now the rule can be configured with:
```toml
[rule.var-naming]
arguments = [["ID"], ["VM", "BAR"]]
```
This way, the linter will ignore `customId` but will throw on `customVm` or `customBar`.
Fix#41
* Adds rule superfluous-else (an extension of indent-error-flow)
* Fix superfluous-else rule struct namming.
* Adds superfuous-else rule to the rules table
* Adds confusing-naming rule
* adds multifile test
* [WIP] fix multiple file test
* draft solution for detecting confusing-names through multiple files
* [WIP] confusing-name multiple files
* clean-up
* draft working version
* cleaner version + more informative messages
* adds check on struct field names
* fix config.go
* clean master
* new ADS rule: newerr
* ADS-print working version
* ads-print final version
* ads-lost-err working version
* confusing-namming: fix tests
* removes ads-* rules
* rule unreachable-code
* unreachable-code refactored version
* skip corner case of mandatory return
* Adds rule superfluous-else (an extension of indent-error-flow)
* Fix superfluous-else rule struct namming.
* Adds superfuous-else rule to the rules table
* Adds confusing-naming rule
* adds multifile test
* [WIP] fix multiple file test
* draft solution for detecting confusing-names through multiple files
* [WIP] confusing-name multiple files
* clean-up
* draft working version
* cleaner version + more informative messages
* adds check on struct field names
* fix config.go
* clean master
* new ADS rule: newerr
* ADS-print working version
* ads-print final version
* ads-lost-err working version
* confusing-namming: fix tests
* moves pick to rule/utils for better reusability
* Fix rule for documentation of exported types
The rule was failing in the following case:
```go
// A is an awesome type
type A = int
```
Because revive was skipping the leading `A`, considering it as an article.
* Add "This" article and update Makefile