Skip to content
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 tools #168

Merged
merged 6 commits into from
May 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
nikolaydubina committed May 27, 2023
commit fe980349fa6bb8c41e38539b9b69e4e781a4deb6
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -917,6 +917,32 @@ Linter for checking that your code uses short syntax for `if` statements wheneve
ifshort ./...
```

```go
// bad
func someFunc(k string, m map[string]interface{}) {
_, ok := m[k]
if !ok {
return
}

err := otherFunc1()
if err != nil {
otherFunc2(err)
}
}

// good
func someFunc(k string, m map[string]interface{}) {
if _, ok := m[k]; !ok {
return
}

if err := otherFunc1(); err != nil {
otherFunc2(err)
}
}
```

Requirements
```
go install github.com/esimonov/ifshort@latest
25 changes: 25 additions & 0 deletions page.yaml
Original file line number Diff line number Diff line change
@@ -559,6 +559,31 @@ groups:
description: Linter for checking that your code uses short syntax for `if` statements whenever possible. However, as of `2023-05-26`, it is not maitaned and is not working.
commands:
- ifshort ./...
example_content_ext: go
example_content: |
// bad
func someFunc(k string, m map[string]interface{}) {
_, ok := m[k]
if !ok {
return
}

err := otherFunc1()
if err != nil {
otherFunc2(err)
}
}

// good
func someFunc(k string, m map[string]interface{}) {
if _, ok := m[k]; !ok {
return
}

if err := otherFunc1(); err != nil {
otherFunc2(err)
}
}
requirements:
- go install github.com/esimonov/ifshort@latest
- title: Code Generation