From e1cd9143e0595c40a22ddba03e778dc623880a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Thu, 24 Sep 2020 12:25:55 +0200 Subject: [PATCH] Package-level comments for static analyzers (#7332) * package-level comments * Merge refs/heads/master into analyzer-package-comments --- tools/analyzers/comparesame/analyzer.go | 4 +++- tools/analyzers/cryptorand/analyzer.go | 2 ++ tools/analyzers/featureconfig/analyzer.go | 1 + tools/analyzers/maligned/analyzer.go | 1 + tools/analyzers/nop/analyzer.go | 1 + tools/analyzers/shadowpredecl/analyzer.go | 2 ++ 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/analyzers/comparesame/analyzer.go b/tools/analyzers/comparesame/analyzer.go index a29ec2ecec..8dc2f9eba2 100644 --- a/tools/analyzers/comparesame/analyzer.go +++ b/tools/analyzers/comparesame/analyzer.go @@ -1,3 +1,5 @@ +// Package comparesame implements a static analyzer to ensure that code does not contain +// comparisons of identical expressions. package comparesame import ( @@ -13,7 +15,7 @@ import ( ) // Doc explaining the tool. -const Doc = "Tool to detect comparison (==, !=, >=, <=, >, <) of identical boolean expressions." +const Doc = "Tool to detect comparison (==, !=, >=, <=, >, <) of identical expressions." const messageTemplate = "Boolean expression has identical expressions on both sides. The result is always %v." diff --git a/tools/analyzers/cryptorand/analyzer.go b/tools/analyzers/cryptorand/analyzer.go index 5c6552e047..495e68c548 100644 --- a/tools/analyzers/cryptorand/analyzer.go +++ b/tools/analyzers/cryptorand/analyzer.go @@ -1,3 +1,5 @@ +// Package cryptorand implements a static analyzer to ensure that the crypto/rand package is used +// for randomness throughout the codebase. package cryptorand import ( diff --git a/tools/analyzers/featureconfig/analyzer.go b/tools/analyzers/featureconfig/analyzer.go index b75c5032f6..02f37c7655 100644 --- a/tools/analyzers/featureconfig/analyzer.go +++ b/tools/analyzers/featureconfig/analyzer.go @@ -1,3 +1,4 @@ +// Package featureconfig implements a static analyzer to prevent leaking globals in tests. package featureconfig import ( diff --git a/tools/analyzers/maligned/analyzer.go b/tools/analyzers/maligned/analyzer.go index 36a6cae565..a502466152 100644 --- a/tools/analyzers/maligned/analyzer.go +++ b/tools/analyzers/maligned/analyzer.go @@ -1,3 +1,4 @@ +// Package maligned implements a static analyzer to ensure that Go structs take up the least possible memory. package maligned import ( diff --git a/tools/analyzers/nop/analyzer.go b/tools/analyzers/nop/analyzer.go index 66b885d543..2a09306a4a 100644 --- a/tools/analyzers/nop/analyzer.go +++ b/tools/analyzers/nop/analyzer.go @@ -1,3 +1,4 @@ +// Package nop implements a static analyzer to ensure that code does not contain no-op instructions. package nop import ( diff --git a/tools/analyzers/shadowpredecl/analyzer.go b/tools/analyzers/shadowpredecl/analyzer.go index 001a0810ce..b39b9f1058 100644 --- a/tools/analyzers/shadowpredecl/analyzer.go +++ b/tools/analyzers/shadowpredecl/analyzer.go @@ -1,3 +1,5 @@ +// Package shadowpredecl implements a static analyzer which disallows declaring constructs +// that shadow predeclared Go identifiers by having the same name. package shadowpredecl import (