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

checkers/preferFprint: fix docs #1142

Merged
merged 1 commit into from Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion checkers/rules/rules.go
Expand Up @@ -339,7 +339,7 @@ func preferWriteByte(m dsl.Matcher) {
).Report(`consider replacing $$ with $w.WriteByte($c)`)
}

//doc:summary Detects fmt.Sprint(f|ln) calls which can be replaced with fmt.Fprint(f|ln)
//doc:summary Detects fmt.Sprint(f/ln) calls which can be replaced with fmt.Fprint(f/ln)
//doc:tags performance experimental
//doc:before w.Write([]byte(fmt.Sprintf("%x", 10)))
//doc:after fmt.Fprintf(w, "%x", 10)
Expand Down
2 changes: 1 addition & 1 deletion checkers/rulesdata/rulesdata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 38 additions & 33 deletions docs/overview.md
Expand Up @@ -52,6 +52,11 @@ They also detect code that may be correct, but looks suspicious.
<a href="#badRegexp-ref">badRegexp</a>
</td>
<td>Detects suspicious regexp patterns</td>
</tr><tr>
<td nowrap>:white_check_mark:
<a href="#badSorting-ref">badSorting</a>
</td>
<td>Detects bad usage of sort package</td>
</tr><tr>
<td nowrap>:white_check_mark:
<a href="#builtinShadowDecl-ref">builtinShadowDecl</a>
Expand Down Expand Up @@ -182,11 +187,6 @@ They also detect code that may be correct, but looks suspicious.
<a href="#sqlQuery-ref">sqlQuery</a>
</td>
<td>Detects issue in Query() and Exec() calls</td>
</tr><tr>
<td nowrap>:white_check_mark:
<a href="#suspiciousSorting-ref">suspiciousSorting</a>
</td>
<td>Detects bad usage of sort package</td>
</tr><tr>
<td nowrap>:white_check_mark:
<a href="#syncMapLoadAndDelete-ref">syncMapLoadAndDelete</a>
Expand Down Expand Up @@ -755,6 +755,31 @@ regexp.MustCompile(`^(?:aa|bb|cc)foo[ab]`)



<a name="badSorting-ref"></a>
## badSorting

[
**diagnostic**
**experimental** ]

Detects bad usage of sort package.





**Before:**
```go
xs = sort.StringSlice(xs)
```

**After:**
```go
sort.Strings(xs)
```



<a name="boolExprSimplify-ref"></a>
## boolExprSimplify

Expand Down Expand Up @@ -2423,12 +2448,12 @@ Detects suspicious http.Error call without following return.

**Before:**
```go
x + string(os.PathSeparator) + y
if err != nil { http.Error(...); }
```

**After:**
```go
filepath.Join(x, y)
if err != nil { http.Error(...); return; }
```


Expand Down Expand Up @@ -2467,12 +2492,17 @@ Checker parameters:
</li>
<li>

`@ruleguard.failOnError` Determines the behavior when an error occurs while parsing ruleguard files.
`@ruleguard.failOn` Determines the behavior when an error occurs while parsing ruleguard files.
If flag is not set, log error and skip rule files that contain an error.
If flag is set, the value must be a comma-separated list of error conditions.
* 'import': rule refers to a package that cannot be loaded.
* 'dsl': gorule file does not comply with the ruleguard DSL. (default )

</li>
<li>

`@ruleguard.failOnError` deprecated, use failOn param; if set to true, identical to failOn='all', otherwise failOn='' (default false)

</li>
<li>

Expand Down Expand Up @@ -2738,31 +2768,6 @@ copy(b, s)



<a name="suspiciousSorting-ref"></a>
## suspiciousSorting

[
**diagnostic**
**experimental** ]

Detects bad usage of sort package.





**Before:**
```go
xs = sort.StringSlice(xs)
```

**After:**
```go
sort.Strings(xs)
```



<a name="switchTrue-ref"></a>
## switchTrue

Expand Down