Files
coder/rules.go
Kyle Carberry 1796dc6c2f chore: Add test helpers to improve coverage (#166)
* chore: Rename ProjectHistory to ProjectVersion

Version more accurately represents version storage. This
forks from the WorkspaceHistory name, but I think it's
easier to understand Workspace history.

* Rename files

* Standardize tests a bit more

* Remove Server struct from coderdtest

* Improve test coverage for workspace history

* Fix linting errors

* Fix coderd test leak

* Fix coderd test leak

* Improve workspace history logs

* Standardize test structure for codersdk

* Fix linting errors

* Fix WebSocket compression

* Update coderd/workspaces.go

Co-authored-by: Bryan <bryan@coder.com>

* Add test for listing project parameters

* Cache npm dependencies with setup node

* Remove windows npm cache key

Co-authored-by: Bryan <bryan@coder.com>
2022-02-05 18:24:51 -06:00

28 lines
621 B
Go

package gorules
import (
"github.com/quasilyte/go-ruleguard/dsl"
)
// Use xerrors everywhere! It provides additional stacktrace info!
//nolint:unused,deadcode,varnamelen
func xerrors(m dsl.Matcher) {
m.Import("errors")
m.Import("fmt")
m.Import("golang.org/x/xerrors")
msg := "Use xerrors to provide additional stacktrace information!"
m.Match("fmt.Errorf($*args)").
Suggest("xerrors.New($args)").
Report(msg)
m.Match("fmt.Errorf($*args)").
Suggest("xerrors.Errorf($args)").
Report(msg)
m.Match("errors.New($msg)").
Where(m["msg"].Type.Is("string")).
Suggest("xerrors.New($msg)").
Report(msg)
}