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

chore(nolint): nolint should have no leading spaces #264

Merged
merged 7 commits into from
Sep 12, 2022
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
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ linters-settings:

# https://github.com/golangci/golangci-lint/blob/master/pkg/golinters/nolintlint
nolintlint:
allow-leading-space: true # allow non-"machine-readable" format (ie. with leading space)
allow-unused: false # allow nolint directives that don't address a linting issue
require-explanation: true # require an explanation for nolint directives
require-specific: true # require nolint directives to be specific about which linter is being skipped
Expand Down
3 changes: 2 additions & 1 deletion constants/badge.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
package constants

// Constants for build badges.
// nolint:godot // due to providing pretty printed svgs
//
//nolint:godot // due to providing pretty printed svgs
const (
// Badge for unknown state
// <svg xmlns="http://www.w3.org/2000/svg" width="92" height="20">
Expand Down
2 changes: 1 addition & 1 deletion database/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (b *Build) Crop() *Build {
// value for the field, the valid flag is set to
// false causing it to be NULL in the database.
//
// nolint: gocyclo // ignore cyclomatic complexity due to number of fields
//nolint:gocyclo // ignore cyclomatic complexity due to number of fields
func (b *Build) Nullify() *Build {
if b == nil {
return nil
Expand Down
2 changes: 1 addition & 1 deletion database/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func randomString(n int) string {

b := make([]rune, n)
for i := range b {
// nolint:gosec // accepting weak RNG for test
//nolint:gosec // accepting weak RNG for test
b[i] = letter[rand.Intn(len(letter))]
}

Expand Down
5 changes: 3 additions & 2 deletions library/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Build struct {
func (b *Build) Duration() string {
// check if the build doesn't have a started timestamp
if b.GetStarted() == 0 {
// nolint: goconst // ignore making a constant
//nolint: goconst // ignore making a constant
return "..."
}

Expand Down Expand Up @@ -1006,7 +1006,8 @@ func (b *Build) SetDistribution(v string) {
}

// String implements the Stringer interface for the Build type.
// nolint:dupl // this is duplicated in the test
//
//nolint:dupl // this is duplicated in the test
func (b *Build) String() string {
return fmt.Sprintf(`{
Author: %s,
Expand Down
2 changes: 1 addition & 1 deletion library/build_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Use of this source code is governed by the LICENSE file in this repository.

// nolint: dupl // ignore false positive with template.go
//nolint:dupl // ignore false positive with template.go
package library

import "fmt"
Expand Down
2 changes: 1 addition & 1 deletion library/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Use of this source code is governed by the LICENSE file in this repository.

// nolint: dupl // ignore false positive with build_queue.go
//nolint:dupl // ignore false positive with build_queue.go
package library

import (
Expand Down
2 changes: 1 addition & 1 deletion pipeline/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func dnsSafeRandomString(n int) string {

b := make([]rune, n)
for i := range b {
// nolint:gosec // this is not about security. Just a random string.
//nolint:gosec // this is not about security. Just a random string.
b[i] = letter[rand.Intn(len(letter))]
}

Expand Down
3 changes: 2 additions & 1 deletion pipeline/ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ func (r *Rules) Empty() bool {
// ruletypes from the rules match the provided ruledata. For
// both operators, when none of the ruletypes from the rules
// match the provided ruledata, the function returns false.
// nolint:gocyclo // accepting complexity in this case
//
//nolint:gocyclo // accepting complexity in this case
func (r *Rules) Match(from *RuleData, matcher, op string) bool {
// set defaults
status := true
Expand Down
4 changes: 2 additions & 2 deletions yaml/ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ func (r *Ruleset) UnmarshalYAML(unmarshal func(interface{}) error) error {
})

// attempt to unmarshal simple ruleset
// nolint:errcheck // intentionally not handling error
//nolint:errcheck // intentionally not handling error
unmarshal(simple)
// attempt to unmarshal advanced ruleset
// nolint:errcheck // intentionally not handling error
//nolint:errcheck // intentionally not handling error
unmarshal(advanced)

// set ruleset `unless` to advanced `unless` rules
Expand Down
3 changes: 2 additions & 1 deletion yaml/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ func (s *ServiceSlice) ToPipeline() *pipeline.ContainerSlice {
}

// UnmarshalYAML implements the Unmarshaler interface for the ServiceSlice type.
// nolint:dupl // accepting duplicative code that exists in step.go as well
//
//nolint:dupl // accepting duplicative code that exists in step.go as well
func (s *ServiceSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
// service slice we try unmarshalling to
serviceSlice := new([]*Service)
Expand Down
3 changes: 2 additions & 1 deletion yaml/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice {
}

// UnmarshalYAML implements the Unmarshaler interface for the StepSlice type.
// nolint:dupl // accepting duplicative code that exits in service.go as well
//
//nolint:dupl // accepting duplicative code that exits in service.go as well
func (s *StepSlice) UnmarshalYAML(unmarshal func(interface{}) error) error {
// step slice we try unmarshalling to
stepSlice := new([]*Step)
Expand Down