1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-24 03:47:45 +02:00
This commit is contained in:
Salvador Cavadini 2018-06-20 13:10:53 +02:00
commit b8d77e5a08
3 changed files with 25 additions and 4 deletions

View File

@ -181,7 +181,7 @@ This will use `config.toml`, the `friendly` formatter, and will run linting over
## Available Rules
List of all available rules. The rules ported from `golint` are left unchanged and indicated in the `golit` column.
List of all available rules. The rules ported from `golint` are left unchanged and indicated in the `golint` column.
| Name | Config | Description | `golint` | Typed |
| --------------------- | :----: | :--------------------------------------------------------------- | :------: | :---: |
@ -318,9 +318,9 @@ Currently, type checking is enabled by default. If you want to run the linter wi
## Contributors
| [<img alt="mgechev" src="https://avatars1.githubusercontent.com/u/455023?v=4&s=117" width="117">](https://github.com/mgechev) | [<img alt="chavacava" src="https://avatars2.githubusercontent.com/u/25788468?v=4&s=117" width="117">](https://github.com/chavacava) | [<img alt="paul-at-start" src="https://avatars2.githubusercontent.com/u/5486775?v=4&s=117" width="117">](https://github.com/paul-at-start) |
| :---------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------: |
| [mgechev](https://github.com/mgechev) | [chavacava](https://github.com/chavacava) | [paul-at-start](https://github.com/paul-at-start) |
[<img alt="mgechev" src="https://avatars1.githubusercontent.com/u/455023?v=4&s=117" width="117">](https://github.com/mgechev) |[<img alt="chavacava" src="https://avatars2.githubusercontent.com/u/25788468?v=4&s=117" width="117">](https://github.com/chavacava) |[<img alt="tamird" src="https://avatars0.githubusercontent.com/u/1535036?v=4&s=117" width="117">](https://github.com/tamird) |[<img alt="paul-at-start" src="https://avatars2.githubusercontent.com/u/5486775?v=4&s=117" width="117">](https://github.com/paul-at-start) |[<img alt="vkrol" src="https://avatars3.githubusercontent.com/u/153412?v=4&s=117" width="117">](https://github.com/vkrol) |
:---: |:---: |:---: |:---: |:---: |
[mgechev](https://github.com/mgechev) |[chavacava](https://github.com/chavacava) |[tamird](https://github.com/tamird) |[paul-at-start](https://github.com/paul-at-start) |[vkrol](https://github.com/vkrol) |
## License

View File

@ -21,3 +21,20 @@ func g(f func() bool) string {
return "it's NOT okay!"
}
}
func h(f func() bool, x int) string {
if err == author.ErrCourseNotFound {
return
} else if err == author.ErrCourseAccess {
// side effect
} else if err == author.AnotherError {
return "okay"
} else {
if ok := f(); ok {
return "it's okay"
} else { // MATCH /if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)/
return "it's NOT okay!"
}
}
}

View File

@ -39,6 +39,9 @@ func (w lintElse) Visit(node ast.Node) ast.Visitor {
return w
}
if w.ignore[ifStmt] {
if elseif, ok := ifStmt.Else.(*ast.IfStmt); ok {
w.ignore[elseif] = true
}
return w
}
if elseif, ok := ifStmt.Else.(*ast.IfStmt); ok {
@ -74,3 +77,4 @@ func (w lintElse) Visit(node ast.Node) ast.Visitor {
}
return w
}