github.com/codeready-toolchain/api@v0.0.0-20240507023248-73662d6db2c5/make/lint.mk (about)

     1  .PHONY: lint
     2  ## Runs linters on Go code files and YAML files
     3  lint: lint-go-code lint-yaml
     4  
     5  YAML_FILES := $(shell find . -type f -regex ".*y[a]ml" -print)
     6  .PHONY: lint-yaml
     7  ## runs yamllint on all yaml files
     8  lint-yaml: ${YAML_FILES}
     9  ifeq (, $(shell which yamllint))
    10  	$(error "yamllint not found in PATH. Please install it using instructions on https://yamllint.readthedocs.io/en/stable/quickstart.html#installing-yamllint")
    11  endif
    12  	$(Q)yamllint -c .yamllint $(YAML_FILES)
    13  
    14  .PHONY: lint-go-code
    15  ## Checks the code with golangci-lint
    16  lint-go-code:
    17  ifeq (, $(shell which golangci-lint 2>/dev/null))
    18  	$(error "golangci-lint not found in PATH. Please install it using instructions on https://golangci-lint.run/usage/install/#local-installation")
    19  endif
    20  	golangci-lint ${V_FLAG} run --config=./.golangci.yml --verbose ./...