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(deps): update dependency golangci/golangci-lint to v1.60.1 #532

Merged
merged 2 commits into from
Aug 20, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ jobs:
lint:
name: Run linters
runs-on: ubuntu-latest
env:
# renovate: datasource=github-releases depName=radiofrance/lint-config
LINT_CONFIG_VERSION: v1.0.0
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: "go.mod"
- name: Download golangci-lint config file
run: curl -o .golangci.yml https://raw.githubusercontent.com/radiofrance/lint-config/${{ env.LINT_CONFIG_VERSION }}/.golangci.yml
- uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
with:
# renovate: datasource=github-releases depName=golangci/golangci-lint
version: v1.57.2
version: v1.60.1

tests:
name: Run tests
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ pkg/dib/tests
pkg/trivy/reports
venv
coverage.output
.golangci.yml
golangci-lint-report.xml
38 changes: 0 additions & 38 deletions .golangci.yml

This file was deleted.

13 changes: 4 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ docs: build
## ----------------------
##

qa: lint test ## Run all QA process
qa: lint test

lint: ## Lint source code
golangci-lint run -v

lint.fix: ## Lint and fix source code
golangci-lint run --fix -v
lint:
curl -o .golangci.yml https://raw.githubusercontent.com/radiofrance/lint-config/main/.golangci.yml
golangci-lint run --verbose

PKG := "./..."
RUN := ".*"
Expand All @@ -50,6 +48,3 @@ test: ## Run tests
sed 's/PAUSE/$(BLUE)PAUSE$(RESET)/g' | \
sed 's/PASS/$(GREEN)PASS$(RESET)/g' | \
sed 's/FAIL/$(RED)FAIL$(RESET)/g'

fmt: ## Run `go fmt` on all files
find -name '*.go' -exec gofmt -w -s '{}' ';'
1 change: 1 addition & 0 deletions pkg/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (d *DAG) Filter(filterFunc func(*Node) bool) *DAG {
return &filteredGraph
}

//nolint:musttag
func (d *DAG) ListImage() string {
imagesList := make(map[string]Image)
d.Walk(func(node *Node) {
Expand Down
1 change: 1 addition & 0 deletions pkg/dag/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (img Image) DockerRef(version string) string {
return fmt.Sprintf("%s:%s", img.Name, version)
}

//nolint:musttag
func (img Image) Print() string {
strImg, err := yaml.Marshal(img)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions pkg/dib/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type BuildOpts struct {
}

// RebuildGraph iterates over the graph to rebuild all the images that are marked to be rebuilt.
//
//nolint:musttag
func (p *Builder) RebuildGraph(
builder types.ImageBuilder,
rateLimiter ratelimit.RateLimiter,
Expand Down
3 changes: 1 addition & 2 deletions pkg/dib/generate_dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ func generateHashes(graph *dag.DAG, allFiles []string, customHashListPath string
// isFileIgnored checks whether a file matches the images ignore patterns.
// It returns true if the file matches at least one pattern (meaning it should be ignored).
func isFileIgnored(node *dag.Node, file string) bool {
if node.Image.IgnorePatterns == nil ||
len(node.Image.IgnorePatterns) == 0 {
if len(node.Image.IgnorePatterns) == 0 {
return false
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/dib/generate_dag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
registryPrefix = "eu.gcr.io/my-test-repository"
)

//nolint:paralleltest
//nolint:paralleltest,dupl
func TestGenerateDAG(t *testing.T) {
t.Run("basic tests", func(t *testing.T) {
graph, err := dib.GenerateDAG(buildPath1, registryPrefix, "", nil)
Expand Down Expand Up @@ -52,6 +52,7 @@ func TestGenerateDAG(t *testing.T) {
multistageNode0 := nodes0["multistage"]

// When I add a new file in bullseye/ (root node)
//nolint:gosec
require.NoError(t, os.WriteFile(
path.Join(buildPath, "bullseye/newfile"),
[]byte("any content"),
Expand Down Expand Up @@ -83,6 +84,7 @@ func TestGenerateDAG(t *testing.T) {
multistageNode0 := nodes0["multistage"]

// When I add a new file in bullseye/multistage/ (child node)
//nolint:gosec
require.NoError(t, os.WriteFile(
path.Join(buildPath, "bullseye/multistage/newfile"),
[]byte("file contents"),
Expand Down
1 change: 1 addition & 0 deletions pkg/kubernetes/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
logger.Infof("Pod %s/%s failed", pod.ObjectMeta.Namespace, pod.ObjectMeta.Name)
errChan <- fmt.Errorf("pod %s terminated (failed)", pod.Name)
return
case corev1.PodPending, corev1.PodUnknown:

Check warning on line 73 in pkg/kubernetes/pod.go

View check run for this annotation

Codecov / codecov/patch

pkg/kubernetes/pod.go#L73

Added line #L73 was not covered by tests
}
case <-time.After(1 * time.Hour):
errChan <- fmt.Errorf("timeout waiting for pod to run to completion")
Expand Down
1 change: 1 addition & 0 deletions pkg/mock/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func NewBuilder() *Builder {

const ReportsDir = "tests/mock-reports"

//nolint:musttag
func (e *Builder) Build(opts types.ImageBuilderOpts) error {
if err := os.MkdirAll(path.Join(ReportsDir, e.ID), 0o755); err != nil && !os.IsExist(err) {
return fmt.Errorf("failed to create mock-reports directory: %w", err)
Expand Down