aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ifuzz
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-06-04 22:35:04 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-06-05 12:23:19 +0200
commit2fcb2b5c16e21d2a94741e19bbe7443d88127273 (patch)
tree13352ecf78a58fc120966ef47a6fc35a10f42551 /pkg/ifuzz
parente3d77cf2a3cefdc0b6781c32ca3b878568a5856b (diff)
.golangci.yml: enable gocognit checker
Finds too complex functions. Similar to gocyclo, but uses somewhat different metric.
Diffstat (limited to 'pkg/ifuzz')
-rw-r--r--pkg/ifuzz/decode.go2
-rw-r--r--pkg/ifuzz/encode.go2
-rw-r--r--pkg/ifuzz/gen/gen.go4
3 files changed, 4 insertions, 4 deletions
diff --git a/pkg/ifuzz/decode.go b/pkg/ifuzz/decode.go
index b16c9f0bd..327fad82e 100644
--- a/pkg/ifuzz/decode.go
+++ b/pkg/ifuzz/decode.go
@@ -10,7 +10,7 @@ import (
// Decode decodes instruction length for the given mode.
// It can have falsely decode incorrect instructions,
// but should not fail to decode correct instructions.
-// nolint: gocyclo, nestif
+// nolint: gocyclo, nestif, gocognit
func Decode(mode int, text []byte) (int, error) {
if len(text) == 0 {
return 0, fmt.Errorf("zero-length instruction")
diff --git a/pkg/ifuzz/encode.go b/pkg/ifuzz/encode.go
index ecabcfcd9..dd884bb61 100644
--- a/pkg/ifuzz/encode.go
+++ b/pkg/ifuzz/encode.go
@@ -11,7 +11,7 @@ import (
"math/rand"
)
-// nolint: gocyclo, nestif
+// nolint: gocyclo, nestif, gocognit
func (insn *Insn) Encode(cfg *Config, r *rand.Rand) []byte {
if !insn.isCompatible(cfg) {
panic("instruction is not suitable for this mode")
diff --git a/pkg/ifuzz/gen/gen.go b/pkg/ifuzz/gen/gen.go
index 86c04617d..72bc1fa0a 100644
--- a/pkg/ifuzz/gen/gen.go
+++ b/pkg/ifuzz/gen/gen.go
@@ -17,7 +17,7 @@ import (
"github.com/google/syzkaller/pkg/serializer"
)
-// nolint: gocyclo
+// nolint: gocyclo, gocognit
func main() {
if len(os.Args) != 2 {
failf("usage: gen instructions.txt")
@@ -180,7 +180,7 @@ func (err errSkip) Error() string {
return string(err)
}
-// nolint: gocyclo
+// nolint: gocyclo, gocognit
func parsePattern(insn *ifuzz.Insn, vals []string) error {
if insn.Opcode != nil {
return fmt.Errorf("PATTERN is already parsed for the instruction")