# SPDX-license-identifier: Apache-2.0 ############################################################################## # Copyright (c) 2024 # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## DOCKER_CMD ?= $(shell which docker 2> /dev/null || which podman 2> /dev/null || echo docker) .PHONY: test test: @go test -v ./... .PHONY: cleanup cleanup: sudo rm -rf node_modules rm -rf .tox/ .venv/ .PHONY: lint lint: cleanup @# Go linting runs via `golangci-lint` (see `make fmt`) using this repo's @# .golangci.yml; codespell and other hooks run via pre-commit, so @# super-linter skips them here to avoid duplicate results. sudo -E $(DOCKER_CMD) run --rm -v $$(pwd):/tmp/lint \ -e RUN_LOCAL=true \ -e LINTER_RULES_PATH=/ \ -e MARKDOWN_CONFIG_FILE=.markdownlint.yml \ -e KUBERNETES_KUBECONFORM_OPTIONS='-ignore-missing-schemas' \ -e VALIDATE_GO_MODULES=false \ -e VALIDATE_GO=false \ -e VALIDATE_BIOME_FORMAT=false \ -e VALIDATE_PRE_COMMIT=false \ -e VALIDATE_SPELL_CODESPELL=false \ ghcr.io/super-linter/super-linter .PHONY: fmt fmt: cleanup @go fmt ./... command -v golangci-lint > /dev/null || go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest $$(command -v golangci-lint || echo $$HOME/go/bin/golangci-lint) run --fix command -v textlint > /dev/null && npm list --global --depth=0 textlint-rule-terminology > /dev/null 2>&1 || sudo npm install --global textlint textlint-rule-terminology textlint . --fix command -v shfmt > /dev/null || curl -s "https://i.jpillora.com/mvdan/sh!!?as=shfmt" | bash shfmt -l -w -s -i 4 . command -v yamlfmt > /dev/null || curl -s "https://i.jpillora.com/google/yamlfmt!!" | bash yamlfmt -dstar **/*.{yaml,yml} npx prettier . --write npx markdownlint-cli2 --fix .