mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 07:31:05 -05:00
chore: format super-linter summaries (#6063)
Run Prettier to format the Super-linter summary file to produce summaries with consistent formatting.
This commit is contained in:
parent
a5c0cf27db
commit
11d4aac68c
19 changed files with 553 additions and 508 deletions
35
.github/linters/.markdown-lint.yml
vendored
35
.github/linters/.markdown-lint.yml
vendored
|
@ -1,35 +1,2 @@
|
||||||
---
|
---
|
||||||
###########################
|
extends: "markdownlint/style/prettier"
|
||||||
###########################
|
|
||||||
## Markdown Linter rules ##
|
|
||||||
###########################
|
|
||||||
###########################
|
|
||||||
|
|
||||||
# Linter rules doc:
|
|
||||||
# - https://github.com/DavidAnson/markdownlint
|
|
||||||
#
|
|
||||||
# Note:
|
|
||||||
# To comment out a single error:
|
|
||||||
# <!-- markdownlint-disable -->
|
|
||||||
# any violations you want
|
|
||||||
# <!-- markdownlint-restore -->
|
|
||||||
#
|
|
||||||
|
|
||||||
###############
|
|
||||||
# Rules by id #
|
|
||||||
###############
|
|
||||||
MD004: false # Unordered list style
|
|
||||||
MD007:
|
|
||||||
indent: 2 # Unordered list indentation
|
|
||||||
MD013:
|
|
||||||
line_length: 808 # Line length
|
|
||||||
MD026:
|
|
||||||
punctuation: ".,;:!。,;:" # List of not allowed
|
|
||||||
MD029: false # Ordered list item prefix
|
|
||||||
MD033: false # Allow inline HTML
|
|
||||||
MD036: false # Emphasis used instead of a heading
|
|
||||||
|
|
||||||
#################
|
|
||||||
# Rules by tags #
|
|
||||||
#################
|
|
||||||
blank_lines: false # Error on blank lines
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Don't format Markdown files to verify tests
|
|
||||||
# because we don't yet generate formatted Markdown
|
|
||||||
# tables when creating the summary file
|
|
||||||
test/data/super-linter-summary/markdown/table/**/*.md
|
|
25
Makefile
25
Makefile
|
@ -145,6 +145,7 @@ open-shell-super-linter-container: ## Open a shell in the Super-linter container
|
||||||
docker run $(DOCKER_FLAGS) \
|
docker run $(DOCKER_FLAGS) \
|
||||||
--interactive \
|
--interactive \
|
||||||
--entrypoint /bin/bash \
|
--entrypoint /bin/bash \
|
||||||
|
--rm \
|
||||||
-v "$(CURDIR)":/tmp/lint \
|
-v "$(CURDIR)":/tmp/lint \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
|
@ -167,6 +168,7 @@ test-actions-runner-debug: ## Run super-linter with ACTIONS_RUNNER_DEBUG=true
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-actions-steps-debug
|
.PHONY: test-actions-steps-debug
|
||||||
|
@ -178,6 +180,7 @@ test-actions-steps-debug: ## Run super-linter with ACTIONS_STEPS_DEBUG=true
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-runner-debug
|
.PHONY: test-runner-debug
|
||||||
|
@ -189,6 +192,7 @@ test-runner-debug: ## Run super-linter with RUNNER_DEBUG=1
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-find
|
.PHONY: test-find
|
||||||
|
@ -200,6 +204,7 @@ test-find: ## Run super-linter on a subdirectory with USE_FIND_ALGORITHM=true
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
# We need to set USE_FIND_ALGORITHM=true because the DEFALUT_WORKSPACE is not
|
# We need to set USE_FIND_ALGORITHM=true because the DEFALUT_WORKSPACE is not
|
||||||
|
@ -215,6 +220,7 @@ test-non-default-workdir: ## Run super-linter with DEFAULT_WORKSPACE set
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
-e VALIDATE_ALL_CODEBASE=true \
|
-e VALIDATE_ALL_CODEBASE=true \
|
||||||
-v $(CURDIR)/.github:/tmp/not-default-workspace/.github \
|
-v $(CURDIR)/.github:/tmp/not-default-workspace/.github \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-git-flags
|
.PHONY: test-git-flags
|
||||||
|
@ -229,6 +235,7 @@ test-git-flags: ## Run super-linter with different git-related flags
|
||||||
-e IGNORE_GITIGNORED_FILES=true \
|
-e IGNORE_GITIGNORED_FILES=true \
|
||||||
-e VALIDATE_ALL_CODEBASE=true \
|
-e VALIDATE_ALL_CODEBASE=true \
|
||||||
-v "$(CURDIR)":/tmp/lint \
|
-v "$(CURDIR)":/tmp/lint \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: lint-codebase
|
.PHONY: lint-codebase
|
||||||
|
@ -246,6 +253,7 @@ lint-codebase: ## Lint the entire codebase
|
||||||
-e SAVE_SUPER_LINTER_SUMMARY=true \
|
-e SAVE_SUPER_LINTER_SUMMARY=true \
|
||||||
-e VALIDATE_ALL_CODEBASE=true \
|
-e VALIDATE_ALL_CODEBASE=true \
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
# Return an error if there are changes to commit
|
# Return an error if there are changes to commit
|
||||||
|
@ -273,6 +281,7 @@ fix-codebase: ## Fix and format the entire codebase
|
||||||
-e SAVE_SUPER_LINTER_SUMMARY=true \
|
-e SAVE_SUPER_LINTER_SUMMARY=true \
|
||||||
-e VALIDATE_ALL_CODEBASE=true \
|
-e VALIDATE_ALL_CODEBASE=true \
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL) \
|
$(SUPER_LINTER_TEST_CONTAINER_URL) \
|
||||||
&& /bin/bash -c "source test/testUtils.sh; if ! CheckUnexpectedGitChanges ${CURDIR}; then exit 1; fi"
|
&& /bin/bash -c "source test/testUtils.sh; if ! CheckUnexpectedGitChanges ${CURDIR}; then exit 1; fi"
|
||||||
|
|
||||||
|
@ -293,6 +302,7 @@ lint-subset-files-enable-only-one-type: ## Lint a small subset of files in the c
|
||||||
-e VALIDATE_ALL_CODEBASE=true \
|
-e VALIDATE_ALL_CODEBASE=true \
|
||||||
-e VALIDATE_MARKDOWN=true \
|
-e VALIDATE_MARKDOWN=true \
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: lint-subset-files-enable-expensive-io-checks
|
.PHONY: lint-subset-files-enable-expensive-io-checks
|
||||||
|
@ -312,6 +322,7 @@ lint-subset-files-enable-expensive-io-checks: ## Lint a small subset of files in
|
||||||
-e VALIDATE_STATES=true \
|
-e VALIDATE_STATES=true \
|
||||||
-e VALIDATE_TEKTON=true \
|
-e VALIDATE_TEKTON=true \
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-lib
|
.PHONY: test-lib
|
||||||
|
@ -323,6 +334,7 @@ test-globals-languages: ## Test globals/languages.sh
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/globalsLanguagesTest.sh \
|
--entrypoint /tmp/lint/test/lib/globalsLanguagesTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-globals-linter-command-options
|
.PHONY: test-globals-linter-command-options
|
||||||
|
@ -331,6 +343,7 @@ test-globals-linter-command-options: ## Test globals/LinterCommandsOptions.sh
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/globalsLinterCommandsOptionsTest.sh \
|
--entrypoint /tmp/lint/test/lib/globalsLinterCommandsOptionsTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-linter-rules
|
.PHONY: test-linter-rules
|
||||||
|
@ -339,6 +352,7 @@ test-linter-rules: ## Test linterRules.sh
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/linterRulesTest.sh \
|
--entrypoint /tmp/lint/test/lib/linterRulesTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-build-file-list
|
.PHONY: test-build-file-list
|
||||||
|
@ -347,6 +361,7 @@ test-build-file-list: ## Test buildFileList
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/buildFileListTest.sh \
|
--entrypoint /tmp/lint/test/lib/buildFileListTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-detect-files
|
.PHONY: test-detect-files
|
||||||
|
@ -355,6 +370,7 @@ test-detect-files: ## Test detectFiles
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/detectFilesTest.sh \
|
--entrypoint /tmp/lint/test/lib/detectFilesTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-github-event
|
.PHONY: test-github-event
|
||||||
|
@ -363,6 +379,7 @@ test-github-event: ## Test githubEvent
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/githubEventTest.sh \
|
--entrypoint /tmp/lint/test/lib/githubEventTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-setup-ssh
|
.PHONY: test-setup-ssh
|
||||||
|
@ -372,6 +389,7 @@ test-setup-ssh: ## Test setupSSH
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/setupSSHTest.sh \
|
--entrypoint /tmp/lint/test/lib/setupSSHTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-validation
|
.PHONY: test-validation
|
||||||
|
@ -380,6 +398,7 @@ test-validation: ## Test validation
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/validationTest.sh \
|
--entrypoint /tmp/lint/test/lib/validationTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-output
|
.PHONY: test-output
|
||||||
|
@ -388,6 +407,7 @@ test-output: ## Test output
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/outputTest.sh \
|
--entrypoint /tmp/lint/test/lib/outputTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-linter-commands
|
.PHONY: test-linter-commands
|
||||||
|
@ -396,6 +416,7 @@ test-linter-commands: ## Test linterCommands
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
-w /tmp/lint \
|
-w /tmp/lint \
|
||||||
--entrypoint /tmp/lint/test/lib/linterCommandsTest.sh \
|
--entrypoint /tmp/lint/test/lib/linterCommandsTest.sh \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
# Run this test against a small directory because we're only interested in
|
# Run this test against a small directory because we're only interested in
|
||||||
|
@ -410,6 +431,7 @@ test-default-config-files: ## Test default configuration files loading
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
-v "$(CURDIR)/docs":/tmp/lint \
|
-v "$(CURDIR)/docs":/tmp/lint \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-custom-ssl-cert
|
.PHONY: test-custom-ssl-cert
|
||||||
|
@ -422,6 +444,7 @@ test-custom-ssl-cert: ## Test the configuration of a custom SSL/TLS certificate
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
-e SSL_CERT_SECRET="$(shell cat test/data/ssl-certificate/rootCA-test.crt)" \
|
-e SSL_CERT_SECRET="$(shell cat test/data/ssl-certificate/rootCA-test.crt)" \
|
||||||
-v "$(CURDIR)/docs":/tmp/lint \
|
-v "$(CURDIR)/docs":/tmp/lint \
|
||||||
|
--rm \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.PHONY: test-non-default-home-directory
|
.PHONY: test-non-default-home-directory
|
||||||
|
@ -562,6 +585,7 @@ build-dev-container-image: docker-dev-container-build-check ## Build commit lint
|
||||||
lint-commits: build-dev-container-image ## Lint commits
|
lint-commits: build-dev-container-image ## Lint commits
|
||||||
docker run \
|
docker run \
|
||||||
-v "$(CURDIR):/source-repository" \
|
-v "$(CURDIR):/source-repository" \
|
||||||
|
--rm \
|
||||||
${DEV_CONTAINER_URL} \
|
${DEV_CONTAINER_URL} \
|
||||||
commitlint \
|
commitlint \
|
||||||
--config .github/linters/commitlint.config.js \
|
--config .github/linters/commitlint.config.js \
|
||||||
|
@ -575,6 +599,7 @@ release-please-dry-run: build-dev-container-image check-github-token ## Run rele
|
||||||
@echo "Running release-please against branch: ${RELEASE_PLEASE_TARGET_BRANCH}"; \
|
@echo "Running release-please against branch: ${RELEASE_PLEASE_TARGET_BRANCH}"; \
|
||||||
docker run \
|
docker run \
|
||||||
-v "$(CURDIR):/source-repository" \
|
-v "$(CURDIR):/source-repository" \
|
||||||
|
--rm \
|
||||||
${DEV_CONTAINER_URL} \
|
${DEV_CONTAINER_URL} \
|
||||||
release-please \
|
release-please \
|
||||||
release-pr \
|
release-pr \
|
||||||
|
|
|
@ -7,7 +7,7 @@ WriteSummaryHeader() {
|
||||||
echo "# Super-linter summary"
|
echo "# Super-linter summary"
|
||||||
echo ""
|
echo ""
|
||||||
echo "| Language | Validation result |"
|
echo "| Language | Validation result |"
|
||||||
echo "| -----------------------|-------------------|"
|
echo "| -------- | ----------------- |"
|
||||||
} >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
} >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,3 +38,20 @@ WriteSummaryFooterFailure() {
|
||||||
echo "Super-linter detected linting errors"
|
echo "Super-linter detected linting errors"
|
||||||
} >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
} >>"${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FormatSuperLinterSummaryFile() {
|
||||||
|
local SUPER_LINTER_SUMMARY_OUTPUT_PATH="${1}"
|
||||||
|
local SUPER_LINTER_SUMMARY_FORMAT_COMMAND=(prettier --write)
|
||||||
|
# Override the default prettier ignore paths (.gitignore, .prettierignore) to
|
||||||
|
# avoid considering their defaults because prettier will skip formatting
|
||||||
|
# the summary report file if the summary report file is ignored in those
|
||||||
|
# ignore files, which is usually the case for generated files.
|
||||||
|
# Ref: https://prettier.io/docs/en/cli#--ignore-path
|
||||||
|
SUPER_LINTER_SUMMARY_FORMAT_COMMAND+=(--ignore-path /dev/null)
|
||||||
|
SUPER_LINTER_SUMMARY_FORMAT_COMMAND+=("${SUPER_LINTER_SUMMARY_OUTPUT_PATH}")
|
||||||
|
debug "Formatting the Super-linter summary file by running: ${SUPER_LINTER_SUMMARY_FORMAT_COMMAND[*]}"
|
||||||
|
if ! "${SUPER_LINTER_SUMMARY_FORMAT_COMMAND[@]}"; then
|
||||||
|
error "Error while formatting the Super-linter summary file."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
|
@ -561,6 +561,9 @@ Footer() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${SAVE_SUPER_LINTER_SUMMARY}" == "true" ]]; then
|
if [[ "${SAVE_SUPER_LINTER_SUMMARY}" == "true" ]]; then
|
||||||
|
if ! FormatSuperLinterSummaryFile "${SUPER_LINTER_SUMMARY_OUTPUT_PATH}"; then
|
||||||
|
fatal "Error while formatting the Super-linter summary file."
|
||||||
|
fi
|
||||||
debug "Super-linter summary file (${SUPER_LINTER_SUMMARY_OUTPUT_PATH}) contents:\n$(cat "${SUPER_LINTER_SUMMARY_OUTPUT_PATH}")"
|
debug "Super-linter summary file (${SUPER_LINTER_SUMMARY_OUTPUT_PATH}) contents:\n$(cat "${SUPER_LINTER_SUMMARY_OUTPUT_PATH}")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
<!-- markdownlint-disable -->
|
|
||||||
|
|
||||||
Super-linter detected linting errors
|
|
|
@ -1,3 +0,0 @@
|
||||||
<!-- markdownlint-disable -->
|
|
||||||
|
|
||||||
All files and directories linted successfully
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Super-linter summary
|
|
||||||
|
|
||||||
| Language | Validation result |
|
|
||||||
| -----------------------|-------------------|
|
|
|
@ -1,2 +0,0 @@
|
||||||
<!-- markdownlint-disable -->
|
|
||||||
| Test Language | Fail ❌ |
|
|
|
@ -1,2 +0,0 @@
|
||||||
<!-- markdownlint-disable -->
|
|
||||||
| Test Language | Pass ✅ |
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Super-linter summary
|
# Super-linter summary
|
||||||
|
|
||||||
<!-- textlint-disable terminology -->
|
<!-- textlint-disable terminology -->
|
||||||
|
|
||||||
| Language | Validation result |
|
| Language | Validation result |
|
||||||
| -----------------------|-------------------|
|
| ---------------------- | ----------------- |
|
||||||
| ANSIBLE | Fail ❌ |
|
| ANSIBLE | Fail ❌ |
|
||||||
| BASH | Fail ❌ |
|
| BASH | Fail ❌ |
|
||||||
| BASH_EXEC | Fail ❌ |
|
| BASH_EXEC | Fail ❌ |
|
||||||
|
@ -83,6 +84,7 @@
|
||||||
| XML | Fail ❌ |
|
| XML | Fail ❌ |
|
||||||
| YAML | Fail ❌ |
|
| YAML | Fail ❌ |
|
||||||
| YAML_PRETTIER | Fail ❌ |
|
| YAML_PRETTIER | Fail ❌ |
|
||||||
|
|
||||||
<!-- textlint-enable terminology -->
|
<!-- textlint-enable terminology -->
|
||||||
|
|
||||||
Super-linter detected linting errors
|
Super-linter detected linting errors
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Super-linter summary
|
# Super-linter summary
|
||||||
|
|
||||||
<!-- textlint-disable terminology -->
|
<!-- textlint-disable terminology -->
|
||||||
|
|
||||||
| Language | Validation result |
|
| Language | Validation result |
|
||||||
| -----------------------|-------------------|
|
| ---------------------------- | ----------------- |
|
||||||
| ANSIBLE | Fail ❌ |
|
| ANSIBLE | Fail ❌ |
|
||||||
| ARM | Fail ❌ |
|
| ARM | Fail ❌ |
|
||||||
| BASH | Fail ❌ |
|
| BASH | Fail ❌ |
|
||||||
|
@ -93,6 +94,7 @@
|
||||||
| XML | Fail ❌ |
|
| XML | Fail ❌ |
|
||||||
| YAML | Fail ❌ |
|
| YAML | Fail ❌ |
|
||||||
| YAML_PRETTIER | Fail ❌ |
|
| YAML_PRETTIER | Fail ❌ |
|
||||||
|
|
||||||
<!-- textlint-enable terminology -->
|
<!-- textlint-enable terminology -->
|
||||||
|
|
||||||
Super-linter detected linting errors
|
Super-linter detected linting errors
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Super-linter summary
|
# Super-linter summary
|
||||||
|
|
||||||
<!-- textlint-disable terminology -->
|
<!-- textlint-disable terminology -->
|
||||||
|
|
||||||
| Language | Validation result |
|
| Language | Validation result |
|
||||||
| -----------------------|-------------------|
|
| ---------------------- | ----------------- |
|
||||||
| ANSIBLE | Pass ✅ |
|
| ANSIBLE | Pass ✅ |
|
||||||
| BASH | Pass ✅ |
|
| BASH | Pass ✅ |
|
||||||
| BASH_EXEC | Pass ✅ |
|
| BASH_EXEC | Pass ✅ |
|
||||||
|
@ -83,6 +84,7 @@
|
||||||
| XML | Pass ✅ |
|
| XML | Pass ✅ |
|
||||||
| YAML | Pass ✅ |
|
| YAML | Pass ✅ |
|
||||||
| YAML_PRETTIER | Pass ✅ |
|
| YAML_PRETTIER | Pass ✅ |
|
||||||
|
|
||||||
<!-- textlint-enable terminology -->
|
<!-- textlint-enable terminology -->
|
||||||
|
|
||||||
All files and directories linted successfully
|
All files and directories linted successfully
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Super-linter summary
|
# Super-linter summary
|
||||||
|
|
||||||
<!-- textlint-disable terminology -->
|
<!-- textlint-disable terminology -->
|
||||||
|
|
||||||
| Language | Validation result |
|
| Language | Validation result |
|
||||||
| -----------------------|-------------------|
|
| ---------------------------- | ----------------- |
|
||||||
| ANSIBLE | Pass ✅ |
|
| ANSIBLE | Pass ✅ |
|
||||||
| ARM | Pass ✅ |
|
| ARM | Pass ✅ |
|
||||||
| BASH | Pass ✅ |
|
| BASH | Pass ✅ |
|
||||||
|
@ -93,6 +94,7 @@
|
||||||
| XML | Pass ✅ |
|
| XML | Pass ✅ |
|
||||||
| YAML | Pass ✅ |
|
| YAML | Pass ✅ |
|
||||||
| YAML_PRETTIER | Pass ✅ |
|
| YAML_PRETTIER | Pass ✅ |
|
||||||
|
|
||||||
<!-- textlint-enable terminology -->
|
<!-- textlint-enable terminology -->
|
||||||
|
|
||||||
All files and directories linted successfully
|
All files and directories linted successfully
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Super-linter summary
|
# Super-linter summary
|
||||||
|
|
||||||
<!-- textlint-disable terminology -->
|
<!-- textlint-disable terminology -->
|
||||||
|
|
||||||
| Language | Validation result |
|
| Language | Validation result |
|
||||||
| -----------------------|-------------------|
|
| ------------------- | ----------------- |
|
||||||
| ANSIBLE | Pass ✅ |
|
| ANSIBLE | Pass ✅ |
|
||||||
| CLANG_FORMAT | Pass ✅ |
|
| CLANG_FORMAT | Pass ✅ |
|
||||||
| CSS | Pass ✅ |
|
| CSS | Pass ✅ |
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
| TYPESCRIPT_STANDARD | Pass ✅ |
|
| TYPESCRIPT_STANDARD | Pass ✅ |
|
||||||
| VUE_PRETTIER | Pass ✅ |
|
| VUE_PRETTIER | Pass ✅ |
|
||||||
| YAML_PRETTIER | Pass ✅ |
|
| YAML_PRETTIER | Pass ✅ |
|
||||||
|
|
||||||
<!-- textlint-enable terminology -->
|
<!-- textlint-enable terminology -->
|
||||||
|
|
||||||
Super-linter detected linting errors
|
Super-linter detected linting errors
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Super-linter summary
|
# Super-linter summary
|
||||||
|
|
||||||
<!-- textlint-disable terminology -->
|
<!-- textlint-disable terminology -->
|
||||||
|
|
||||||
| Language | Validation result |
|
| Language | Validation result |
|
||||||
| -----------------------|-------------------|
|
| ---------------------------- | ----------------- |
|
||||||
| ANSIBLE | Pass ✅ |
|
| ANSIBLE | Pass ✅ |
|
||||||
| CLANG_FORMAT | Pass ✅ |
|
| CLANG_FORMAT | Pass ✅ |
|
||||||
| CSHARP | Pass ✅ |
|
| CSHARP | Pass ✅ |
|
||||||
|
@ -51,6 +52,7 @@
|
||||||
| TYPESCRIPT_STANDARD | Pass ✅ |
|
| TYPESCRIPT_STANDARD | Pass ✅ |
|
||||||
| VUE_PRETTIER | Pass ✅ |
|
| VUE_PRETTIER | Pass ✅ |
|
||||||
| YAML_PRETTIER | Pass ✅ |
|
| YAML_PRETTIER | Pass ✅ |
|
||||||
|
|
||||||
<!-- textlint-enable terminology -->
|
<!-- textlint-enable terminology -->
|
||||||
|
|
||||||
Super-linter detected linting errors
|
Super-linter detected linting errors
|
||||||
|
|
|
@ -10,6 +10,9 @@ LOG_LEVEL="DEBUG"
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "lib/functions/log.sh"
|
source "lib/functions/log.sh"
|
||||||
|
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "test/testUtils.sh"
|
||||||
|
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
source "lib/functions/output.sh"
|
source "lib/functions/output.sh"
|
||||||
|
|
||||||
|
@ -24,14 +27,14 @@ function CleanupWorkspace() {
|
||||||
rm -rf "${TEMP_WORKSPACE}"
|
rm -rf "${TEMP_WORKSPACE}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckIfFileDiff() {
|
CheckIfContentsDiff() {
|
||||||
local INPUT_FILE="${1}"
|
local INPUT_FILE_CONTENT
|
||||||
local EXPECTED_FILE="${2}"
|
INPUT_FILE_CONTENT="$(cat "${1}")"
|
||||||
# Remove eventual HTML comments from the expected file because we use them to disable certain linter rules
|
local EXPECTED_CONTENT="${2}"
|
||||||
if ! diff "${INPUT_FILE}" <(grep -vE '^\s*<!--' "${EXPECTED_FILE}"); then
|
if [[ "${INPUT_FILE_CONTENT}" != "${EXPECTED_CONTENT}" ]]; then
|
||||||
fatal "${INPUT_FILE} contents don't match with the expected contents (${EXPECTED_FILE})"
|
fatal "\n${INPUT_FILE_CONTENT}\ncontents don't match the expected contents:\n${EXPECTED_CONTENT}"
|
||||||
else
|
else
|
||||||
echo "${INPUT_FILE} contents match with the expected contents (${EXPECTED_FILE})"
|
debug "\n${INPUT_FILE_CONTENT}\ncontents match the expected contents\n${EXPECTED_CONTENT}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +46,16 @@ function WriteSummaryMarkdownTableHeaderTest() {
|
||||||
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output.md"
|
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output.md"
|
||||||
InitWorkspace
|
InitWorkspace
|
||||||
WriteSummaryHeader "${RESULTS_FILE}"
|
WriteSummaryHeader "${RESULTS_FILE}"
|
||||||
CheckIfFileDiff "${RESULTS_FILE}" "test/data/super-linter-summary/markdown/table/expected-summary-heading.md"
|
local EXPECTED_CONTENT
|
||||||
|
EXPECTED_CONTENT=$(
|
||||||
|
cat <<EOF
|
||||||
|
# Super-linter summary
|
||||||
|
|
||||||
|
| Language | Validation result |
|
||||||
|
| -------- | ----------------- |
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
CheckIfContentsDiff "${RESULTS_FILE}" "${EXPECTED_CONTENT}"
|
||||||
CleanupWorkspace
|
CleanupWorkspace
|
||||||
|
|
||||||
notice "${FUNCTION_NAME} PASS"
|
notice "${FUNCTION_NAME} PASS"
|
||||||
|
@ -57,7 +69,7 @@ function WriteSummaryMarkdownTableLineSuccessTest() {
|
||||||
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
||||||
InitWorkspace
|
InitWorkspace
|
||||||
WriteSummaryLineSuccess "${RESULTS_FILE}" "Test Language"
|
WriteSummaryLineSuccess "${RESULTS_FILE}" "Test Language"
|
||||||
CheckIfFileDiff "${RESULTS_FILE}" "test/data/super-linter-summary/markdown/table/expected-summary-line-success.md"
|
CheckIfContentsDiff "${RESULTS_FILE}" "| Test Language | Pass ✅ |"
|
||||||
CleanupWorkspace
|
CleanupWorkspace
|
||||||
|
|
||||||
notice "${FUNCTION_NAME} PASS"
|
notice "${FUNCTION_NAME} PASS"
|
||||||
|
@ -71,7 +83,7 @@ function WriteSummaryMarkdownTableLineFailureTest() {
|
||||||
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
||||||
InitWorkspace
|
InitWorkspace
|
||||||
WriteSummaryLineFailure "${RESULTS_FILE}" "Test Language"
|
WriteSummaryLineFailure "${RESULTS_FILE}" "Test Language"
|
||||||
CheckIfFileDiff "${RESULTS_FILE}" "test/data/super-linter-summary/markdown/table/expected-summary-line-failure.md"
|
CheckIfContentsDiff "${RESULTS_FILE}" "| Test Language | Fail ❌ |"
|
||||||
CleanupWorkspace
|
CleanupWorkspace
|
||||||
|
|
||||||
notice "${FUNCTION_NAME} PASS"
|
notice "${FUNCTION_NAME} PASS"
|
||||||
|
@ -85,7 +97,14 @@ function WriteSummaryMarkdownTableFooterSuccessTest() {
|
||||||
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
||||||
InitWorkspace
|
InitWorkspace
|
||||||
WriteSummaryFooterSuccess "${RESULTS_FILE}"
|
WriteSummaryFooterSuccess "${RESULTS_FILE}"
|
||||||
CheckIfFileDiff "${RESULTS_FILE}" "test/data/super-linter-summary/markdown/table/expected-summary-footer-success.md"
|
local EXPECTED_CONTENT
|
||||||
|
EXPECTED_CONTENT=$(
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
All files and directories linted successfully
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
CheckIfContentsDiff "${RESULTS_FILE}" "${EXPECTED_CONTENT}"
|
||||||
CleanupWorkspace
|
CleanupWorkspace
|
||||||
|
|
||||||
notice "${FUNCTION_NAME} PASS"
|
notice "${FUNCTION_NAME} PASS"
|
||||||
|
@ -99,7 +118,14 @@ function WriteSummaryMarkdownTableFooterFailureTest() {
|
||||||
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
local RESULTS_FILE="${TEMP_WORKSPACE}/${FUNCTION_NAME}-output-${FUNCTION_NAME}.md"
|
||||||
InitWorkspace
|
InitWorkspace
|
||||||
WriteSummaryFooterFailure "${RESULTS_FILE}"
|
WriteSummaryFooterFailure "${RESULTS_FILE}"
|
||||||
CheckIfFileDiff "${RESULTS_FILE}" "test/data/super-linter-summary/markdown/table/expected-summary-footer-failure.md"
|
local EXPECTED_CONTENT
|
||||||
|
EXPECTED_CONTENT=$(
|
||||||
|
cat <<EOF
|
||||||
|
|
||||||
|
Super-linter detected linting errors
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
CheckIfContentsDiff "${RESULTS_FILE}" "${EXPECTED_CONTENT}"
|
||||||
CleanupWorkspace
|
CleanupWorkspace
|
||||||
|
|
||||||
notice "${FUNCTION_NAME} PASS"
|
notice "${FUNCTION_NAME} PASS"
|
||||||
|
|
|
@ -359,15 +359,14 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH:-}" ]; then
|
if [ -n "${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH:-}" ]; then
|
||||||
# Remove eventual HTML comments from the expected file because we use them to disable certain linter rules
|
if ! AssertFileContentsMatchIgnoreHtmlComments "${SUPER_LINTER_SUMMARY_FILE_PATH}" "${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH}"; then
|
||||||
if ! diff "${SUPER_LINTER_SUMMARY_FILE_PATH}" <(grep -vE '^\s*<!--' "${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH}"); then
|
|
||||||
debug "Super-linter summary (${SUPER_LINTER_SUMMARY_FILE_PATH}) contents don't match with the expected contents (${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH})"
|
debug "Super-linter summary (${SUPER_LINTER_SUMMARY_FILE_PATH}) contents don't match with the expected contents (${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH})"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
debug "Super-linter summary (${SUPER_LINTER_SUMMARY_FILE_PATH}) contents match with the expected contents (${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH})"
|
debug "Super-linter summary (${SUPER_LINTER_SUMMARY_FILE_PATH}) contents match with the expected contents (${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! diff "${SUPER_LINTER_GITHUB_STEP_SUMMARY_FILE_PATH}" <(grep -vE '^\s*<!--' "${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH}"); then
|
if ! AssertFileContentsMatchIgnoreHtmlComments "${SUPER_LINTER_GITHUB_STEP_SUMMARY_FILE_PATH}" "${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH}"; then
|
||||||
debug "Super-linter GitHub step summary (${SUPER_LINTER_SUMMARY_FILE_PATH}) contents don't match with the expected contents (${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH})"
|
debug "Super-linter GitHub step summary (${SUPER_LINTER_SUMMARY_FILE_PATH}) contents don't match with the expected contents (${EXPECTED_SUPER_LINTER_SUMMARY_FILE_PATH})"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
@ -450,7 +449,7 @@ if [[ "${VERIFY_FIX_MODE:-}" == "true" ]]; then
|
||||||
"${BAD_TEST_CASE_DESTINATION_PATH}"/*/target
|
"${BAD_TEST_CASE_DESTINATION_PATH}"/*/target
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if AssertFileContentsMatch "${BAD_TEST_CASE_DESTINATION_PATH}" "${BAD_TEST_CASE_SOURCE_PATH}"; then
|
if AssertFileAndDirContentsMatch "${BAD_TEST_CASE_DESTINATION_PATH}" "${BAD_TEST_CASE_SOURCE_PATH}"; then
|
||||||
fatal "${BAD_TEST_CASE_DESTINATION_PATH} contents match ${BAD_TEST_CASE_SOURCE_PATH} contents and they should differ because fix mode for ${LANGUAGE} should have fixed linting and formatting issues."
|
fatal "${BAD_TEST_CASE_DESTINATION_PATH} contents match ${BAD_TEST_CASE_SOURCE_PATH} contents and they should differ because fix mode for ${LANGUAGE} should have fixed linting and formatting issues."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -120,7 +120,7 @@ function CheckUnexpectedGitChanges() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
AssertFileContentsMatch() {
|
AssertFileAndDirContentsMatch() {
|
||||||
local FILE_1_PATH="${1}"
|
local FILE_1_PATH="${1}"
|
||||||
local FILE_2_PATH="${2}"
|
local FILE_2_PATH="${2}"
|
||||||
if diff -r "${FILE_1_PATH}" "${FILE_2_PATH}"; then
|
if diff -r "${FILE_1_PATH}" "${FILE_2_PATH}"; then
|
||||||
|
@ -132,6 +132,20 @@ AssertFileContentsMatch() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssertFileContentsMatchIgnoreHtmlComments() {
|
||||||
|
local FILE_1_PATH="${1}"
|
||||||
|
local FILE_2_PATH="${2}"
|
||||||
|
# Use cat -s to remove duplicate blank lines because Prettier adds blank
|
||||||
|
# lines after HTML comments in Markdown files
|
||||||
|
if diff "${FILE_1_PATH}" <(grep -vE '^\s*<!--' "${FILE_2_PATH}" | cat -s); then
|
||||||
|
echo "${FILE_1_PATH} contents match with ${FILE_2_PATH} contents"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "${FILE_1_PATH} contents don't match with ${FILE_2_PATH} contents"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
IsLanguageInSlimImage() {
|
IsLanguageInSlimImage() {
|
||||||
local LANGUAGE="${1}"
|
local LANGUAGE="${1}"
|
||||||
if [[ " ${LANGUAGES_NOT_IN_SLIM_IMAGE[*]} " =~ [[:space:]]${LANGUAGE}[[:space:]] ]]; then
|
if [[ " ${LANGUAGES_NOT_IN_SLIM_IMAGE[*]} " =~ [[:space:]]${LANGUAGE}[[:space:]] ]]; then
|
||||||
|
|
Loading…
Reference in a new issue