Add Stutter linter

This also adds a bunch of nolints for the node package which
has a ton of stuttering. Perhaps something to mitigate in another
iteration.
This commit is contained in:
Sargun Dhillon
2020-12-07 01:43:38 -08:00
parent d29adf5ce3
commit 0d1f6f1625
3 changed files with 5 additions and 8 deletions

View File

@@ -22,6 +22,3 @@ issues:
exclude: exclude:
# EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok # EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# EXC0003 golint: False positive when tests are defined in package 'test'
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this

View File

@@ -42,7 +42,7 @@ var (
*/ */
// MockProvider implements the virtual-kubelet provider interface and stores pods in memory. // MockProvider implements the virtual-kubelet provider interface and stores pods in memory.
type MockProvider struct { type MockProvider struct { // nolint:golint
nodeName string nodeName string
operatingSystem string operatingSystem string
internalIP string internalIP string
@@ -54,7 +54,7 @@ type MockProvider struct {
} }
// MockConfig contains a mock virtual-kubelet's configurable parameters. // MockConfig contains a mock virtual-kubelet's configurable parameters.
type MockConfig struct { type MockConfig struct { // nolint:golint
CPU string `json:"cpu,omitempty"` CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"` Memory string `json:"memory,omitempty"`
Pods string `json:"pods,omitempty"` Pods string `json:"pods,omitempty"`

View File

@@ -46,7 +46,7 @@ const (
// //
// Note: Implementers can choose to manage a node themselves, in which case // Note: Implementers can choose to manage a node themselves, in which case
// it is not needed to provide an implementation for this interface. // it is not needed to provide an implementation for this interface.
type NodeProvider interface { type NodeProvider interface { // nolint:golint
// Ping checks if the node is still active. // Ping checks if the node is still active.
// This is intended to be lightweight as it will be called periodically as a // This is intended to be lightweight as it will be called periodically as a
// heartbeat to keep the node marked as ready in Kubernetes. // heartbeat to keep the node marked as ready in Kubernetes.
@@ -96,7 +96,7 @@ func NewNodeController(p NodeProvider, node *corev1.Node, nodes v1.NodeInterface
} }
// NodeControllerOpt are the functional options used for configuring a node // NodeControllerOpt are the functional options used for configuring a node
type NodeControllerOpt func(*NodeController) error type NodeControllerOpt func(*NodeController) error // nolint:golint
// WithNodeEnableLeaseV1Beta1 enables support for v1beta1 leases. // WithNodeEnableLeaseV1Beta1 enables support for v1beta1 leases.
// If client is nil, leases will not be enabled. // If client is nil, leases will not be enabled.
@@ -174,7 +174,7 @@ type ErrorHandler func(context.Context, error) error
// NodeController deals with creating and managing a node object in Kubernetes. // NodeController deals with creating and managing a node object in Kubernetes.
// It can register a node with Kubernetes and periodically update its status. // It can register a node with Kubernetes and periodically update its status.
// NodeController manages a single node entity. // NodeController manages a single node entity.
type NodeController struct { type NodeController struct { // nolint:golint
p NodeProvider p NodeProvider
// serverNode should only be written to on initialization, or as the result of node creation. // serverNode should only be written to on initialization, or as the result of node creation.