You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-29 21:48:14 +02:00
Enable gocritic and don't ignore globally (#3159)
Use `nolint` directives instead. From #2960
This commit is contained in:
@@ -40,7 +40,7 @@ func (c *volumeCacher) Restore(repo, branch string, mounts []string) *yaml_types
|
||||
"mount": mounts,
|
||||
"path": "/cache",
|
||||
"restore": true,
|
||||
"file": strings.Replace(branch, "/", "_", -1) + ".tar",
|
||||
"file": strings.ReplaceAll(branch, "/", "_") + ".tar",
|
||||
"fallback_to": "main.tar",
|
||||
},
|
||||
Volumes: yaml_types.Volumes{
|
||||
@@ -64,7 +64,7 @@ func (c *volumeCacher) Rebuild(repo, branch string, mounts []string) *yaml_types
|
||||
"path": "/cache",
|
||||
"rebuild": true,
|
||||
"flush": true,
|
||||
"file": strings.Replace(branch, "/", "_", -1) + ".tar",
|
||||
"file": strings.ReplaceAll(branch, "/", "_") + ".tar",
|
||||
},
|
||||
Volumes: yaml_types.Volumes{
|
||||
Volumes: []*yaml_types.Volume{
|
||||
|
||||
@@ -254,7 +254,7 @@ func (c *List) UnmarshalYAML(value *yaml.Node) error {
|
||||
err2 := value.Decode(&out2)
|
||||
|
||||
c.Exclude = out1.Exclude
|
||||
c.Include = append(
|
||||
c.Include = append( //nolint:gocritic
|
||||
out1.Include,
|
||||
out2...,
|
||||
)
|
||||
@@ -335,7 +335,7 @@ func (c *Path) UnmarshalYAML(value *yaml.Node) error {
|
||||
|
||||
c.Exclude = out1.Exclude
|
||||
c.IgnoreMessage = out1.IgnoreMessage
|
||||
c.Include = append(
|
||||
c.Include = append( //nolint:gocritic
|
||||
out1.Include,
|
||||
out2...,
|
||||
)
|
||||
|
||||
@@ -89,7 +89,7 @@ func calc(matrix Matrix) []Axis {
|
||||
decr := perm
|
||||
for i, tag := range tags {
|
||||
elems := matrix[tag]
|
||||
decr = decr / len(elems)
|
||||
decr /= len(elems)
|
||||
elem := p / decr % len(elems)
|
||||
axis[tag] = elems[elem]
|
||||
|
||||
|
||||
@@ -34,11 +34,12 @@ func ParseBytes(b []byte) (*types.Workflow, error) {
|
||||
|
||||
// support deprecated branch filter
|
||||
if out.BranchesDontUseIt != nil {
|
||||
if out.When.Constraints == nil {
|
||||
switch {
|
||||
case out.When.Constraints == nil:
|
||||
out.When.Constraints = []constraint.Constraint{{Branch: *out.BranchesDontUseIt}}
|
||||
} else if len(out.When.Constraints) == 1 && out.When.Constraints[0].Branch.IsEmpty() {
|
||||
case len(out.When.Constraints) == 1 && out.When.Constraints[0].Branch.IsEmpty():
|
||||
out.When.Constraints[0].Branch = *out.BranchesDontUseIt
|
||||
} else {
|
||||
default:
|
||||
return nil, fmt.Errorf("could not apply deprecated branches filter into global when filter")
|
||||
}
|
||||
out.BranchesDontUseIt = nil
|
||||
|
||||
Reference in New Issue
Block a user