Skip to content
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
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
check-latest: true
- name: Check out code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Full history is required for golangci-lint's merge-base
# (new-issues) gating to diff a PR against the default branch.
fetch-depth: 0
- name: Cache Go modules
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
id: go-mod-cache
Expand All @@ -53,6 +57,10 @@ jobs:
${{ runner.os }}-go-
- name: Get dependencies
run: make download
- name: Lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v2.5.0
- name: Build
run: make build
- name: Run unit tests
Expand Down
53 changes: 53 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright The Notary Project Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

version: "2"

run:
timeout: 5m

# Adopt linting incrementally: only fail on issues introduced by a PR relative
# to its merge base with the default branch, not on the pre-existing backlog.
# Remove `new-from-merge-base` once the backlog under `make lint` is cleared to
# enforce linting across the whole tree.
issues:
new-from-merge-base: origin/main
max-issues-per-linter: 0
max-same-issues: 0

linters:
# Start conservative: the default set plus a few high-signal linters.
# Expand this list over time as the codebase is cleaned up.
default: standard
enable:
- bodyclose
- misspell
- revive
- unconvert
- whitespace
exclusions:
generated: lax
presets:
- comments
- std-error-handling
paths:
- test/e2e

formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/notaryproject/notation
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ e2e-covdata:
export GO_INSTRUMENT_FLAGS='-coverpkg "github.com/notaryproject/notation/v2/internal/...,github.com/notaryproject/notation/v2/cmd/..."'; \
$(MAKE) e2e && go tool covdata textfmt -i=$$GOCOVERDIR -o "$(CURDIR)/test/e2e/coverage.txt"

.PHONY: lint
lint: ## run golangci-lint (install: https://golangci-lint.run/welcome/install/)
golangci-lint run

.PHONY: clean
clean:
git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf
Expand Down
Loading