-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
139 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Managed by makego. DO NOT EDIT. | ||
|
||
# Must be set | ||
$(call _assert_var,MAKEGO) | ||
$(call _conditional_include,$(MAKEGO)/base.mk) | ||
$(call _assert_var,UNAME_OS) | ||
$(call _assert_var,UNAME_ARCH) | ||
$(call _assert_var,CACHE_VERSIONS) | ||
$(call _assert_var,CACHE_BIN) | ||
|
||
# Settable | ||
# https://github.com/mikefarah/yq/releases 20240225 checked 20240320 | ||
YQ_VERSION ?= v4.42.1 | ||
|
||
ifeq ($(UNAME_OS),Darwin) | ||
YQ_OS := darwin | ||
ifeq ($(UNAME_ARCH),x86_64) | ||
YQ_ARCH := amd64 | ||
endif | ||
ifeq ($(UNAME_ARCH),arm64) | ||
YQ_ARCH := arm64 | ||
endif | ||
endif | ||
|
||
ifeq ($(UNAME_ARCH),x86_64) | ||
ifeq ($(UNAME_OS),Linux) | ||
YQ_OS := linux | ||
YQ_ARCH := amd64 | ||
endif | ||
endif | ||
|
||
YQ := $(CACHE_VERSIONS)/yq/$(YQ_VERSION) | ||
$(YQ): | ||
@rm -f $(CACHE_BIN)/yq | ||
@mkdir -p $(CACHE_BIN) | ||
curl -sSL \ | ||
https://github.com/mikefarah/yq/releases/download/$(YQ_VERSION)/yq_$(YQ_OS)_$(YQ_ARCH) \ | ||
-o $(CACHE_BIN)/yq | ||
chmod +x $(CACHE_BIN)/yq | ||
@rm -rf $(dir $(YQ)) | ||
@mkdir -p $(dir $(YQ)) | ||
@touch $(YQ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Managed by makego. DO NOT EDIT. | ||
|
||
## checknolintlint exits with exit code 0 if nolintlint is enabled and configured according to standards. | ||
## Otherwise, it exits with exit code 1. | ||
|
||
set -euo pipefail | ||
|
||
if [[ ! -f .golangci.yml ]]; then | ||
echo "nolintlint not enabled in .golangci.yml" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Check if nolintlint linter is enabled in config | ||
NOLINTLINT_ENABLED=0 | ||
if [[ `yq '.linters.enable // [] | any_c(. == "nolintlint")' .golangci.yml` == "true" ]]; then | ||
# Enabled individually | ||
NOLINTLINT_ENABLED=1 | ||
elif [[ `yq '.linters.enable-all' .golangci.yml` == "true" ]]; then | ||
# Enabled with enable-all | ||
NOLINTLINT_ENABLED=1 | ||
fi | ||
if [ "${NOLINTLINT_ENABLED}" -eq 1 ]; then | ||
# Ensure it isn't disabled individually | ||
if [[ `yq '.linters.disable // [] | any_c(. == "nolintlint")' .golangci.yml` == "true" ]]; then | ||
NOLINTLINT_ENABLED=0 | ||
fi | ||
fi | ||
if [ "${NOLINTLINT_ENABLED}" -eq 0 ]; then | ||
echo "nolintlint not enabled in .golangci.yml" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Check if nolintlint is configured according to standards. | ||
# | ||
# linters-settings: | ||
# nolintlint: | ||
# allow-unused: false | ||
# allow-no-explanation: [] | ||
# require-explanation: true | ||
# require-specific: true | ||
# | ||
|
||
# These values will be set below by the yq command (if set in the file). | ||
allow_unused= | ||
require_explanation= | ||
require_specific= | ||
allow_no_explanation_0= | ||
|
||
eval $(yq --output-format shell '.linters-settings.nolintlint' .golangci.yml) | ||
if [[ "${allow_unused}" != "false" ]]; then | ||
echo ".golangci.yml: nolintlint allow-unused must be set to false" >&2 | ||
exit 1 | ||
fi | ||
if [[ "${require_explanation}" != "true" ]]; then | ||
echo ".golangci.yml: nolintlint require-explanation must be set to true" >&2 | ||
exit 1 | ||
fi | ||
if [[ "${require_specific}" != "true" ]]; then | ||
echo ".golangci.yml: nolintlint require-specific must be set to true" >&2 | ||
exit 1 | ||
fi | ||
if [[ -n "${allow_no_explanation_0}" ]]; then | ||
echo ".golangci.yml: nolintlint allow-no-explanation must be empty" >&2 | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters