mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 04:32:16 -05:00
now with files
This commit is contained in:
parent
c3dbafde0c
commit
d8b13b0fd8
9 changed files with 191 additions and 4 deletions
19
.automation/test/tekton/README.md
Normal file
19
.automation/test/tekton/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Tekton language Test Cases
|
||||
|
||||
This folder holds the test cases for **Tekton**.
|
||||
|
||||
## Additional Docs
|
||||
|
||||
No Additional information is needed for this test case.
|
||||
|
||||
## Good Test Cases
|
||||
|
||||
The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted.
|
||||
|
||||
- **Note:** They are linted utilizing the default linter rules.
|
||||
|
||||
## Bad Test Cases
|
||||
|
||||
The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted.
|
||||
|
||||
- **Note:** They are linted utilizing the default linter rules.
|
49
.automation/test/tekton/bad/tekton_bad_1.yml
Normal file
49
.automation/test/tekton/bad/tekton_bad_1.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: build-and-deploy-pipeline
|
||||
spec:
|
||||
resources:
|
||||
- name: git-source
|
||||
type: git
|
||||
params:
|
||||
- name: pathToContext and space
|
||||
description: The path to the build context, used by Kaniko - within the workspace
|
||||
default:
|
||||
- name: pathToYamlFile
|
||||
description: The path to the yaml file to deploy within the git source
|
||||
- name: imageUrl
|
||||
description: Url of image repository
|
||||
- name:
|
||||
description: Tag to apply to the built image
|
||||
tasks:
|
||||
- name: source-to-image
|
||||
taskRef:
|
||||
name: source-to-image
|
||||
params:
|
||||
- name: pathToContext
|
||||
value: "$(params.pathToContext)"
|
||||
- name: imageUrl
|
||||
value: "$(params.imageUrl)"
|
||||
- name: imageTag
|
||||
value: "$(params.imageTag)"
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
||||
- name: deploy-to-cluster
|
||||
taskRef:
|
||||
name: deploy-using-kubectl
|
||||
runAfter:
|
||||
- source-to-image
|
||||
params:
|
||||
- name: pathToYamlFile
|
||||
value: "$(params.pathToYamlFile)"
|
||||
- name: imageUrl
|
||||
value: "$(params.imageUrl)"
|
||||
- name: imageTag
|
||||
value: "$(params.imageTag)"
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
49
.automation/test/tekton/good/tekton_good_1.yml
Normal file
49
.automation/test/tekton/good/tekton_good_1.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: build-and-deploy-pipeline
|
||||
spec:
|
||||
resources:
|
||||
- name: git-source
|
||||
type: git
|
||||
params:
|
||||
- name: pathToContext
|
||||
description: The path to the build context, used by Kaniko - within the workspace
|
||||
default: src
|
||||
- name: pathToYamlFile
|
||||
description: The path to the yaml file to deploy within the git source
|
||||
- name: imageUrl
|
||||
description: Url of image repository
|
||||
- name: imageTag
|
||||
description: Tag to apply to the built image
|
||||
tasks:
|
||||
- name: source-to-image
|
||||
taskRef:
|
||||
name: source-to-image
|
||||
params:
|
||||
- name: pathToContext
|
||||
value: "$(params.pathToContext)"
|
||||
- name: imageUrl
|
||||
value: "$(params.imageUrl)"
|
||||
- name: imageTag
|
||||
value: "$(params.imageTag)"
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
||||
- name: deploy-to-cluster
|
||||
taskRef:
|
||||
name: deploy-using-kubectl
|
||||
runAfter:
|
||||
- source-to-image
|
||||
params:
|
||||
- name: pathToYamlFile
|
||||
value: "$(params.pathToYamlFile)"
|
||||
- name: imageUrl
|
||||
value: "$(params.imageUrl)"
|
||||
- name: imageTag
|
||||
value: "$(params.imageTag)"
|
||||
resources:
|
||||
inputs:
|
||||
- name: git-source
|
||||
resource: git-source
|
|
@ -79,6 +79,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
|
|||
| **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) / [executable bit check] / [shfmt](https://github.com/mvdan/sh) |
|
||||
| **Snakemake** | [snakefmt](https://github.com/snakemake/snakefmt/) / [snakemake --lint](https://snakemake.readthedocs.io/en/stable/snakefiles/writing_snakefiles.html#best-practices) |
|
||||
| **SQL** | [sql-lint](https://github.com/joereynolds/sql-lint) |
|
||||
| **Tekton** | [tekton-lint](https://github.com/IBM/tekton-lint) |
|
||||
| **Terraform** | [tflint](https://github.com/terraform-linters/tflint) / [terrascan](https://github.com/accurics/terrascan) |
|
||||
| **Terragrunt** | [terragrunt](https://github.com/gruntwork-io/terragrunt) |
|
||||
| **TypeScript** | [eslint](https://eslint.org/) / [standard js](https://standardjs.com/) |
|
||||
|
@ -277,6 +278,7 @@ But if you wish to select or exclude specific linters, we give you full control
|
|||
| **VALIDATE_SNAKEMAKE_SNAKEFMT** | `true` | Flag to enable or disable the linting process of Snakefiles. (Utilizing: snakefmt) |
|
||||
| **VALIDATE_STATES** | `true` | Flag to enable or disable the linting process for AWS States Language. |
|
||||
| **VALIDATE_SQL** | `true` | Flag to enable or disable the linting process of the SQL language. |
|
||||
| **VALIDATE_TEKTON** | `true` | Flag to enable or disable the linting process of the Tekton language. |
|
||||
| **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the Terraform language. |
|
||||
| **VALIDATE_TERRAFORM_TERRASCAN** | `true` | Flag to enable or disable the linting process of the Terraform language for security related issues. |
|
||||
| **VALIDATE_TERRAGRUNT** | `true` | Flag to enable or disable the linting process for Terragrunt files. |
|
||||
|
|
|
@ -51,6 +51,7 @@ For some linters it is also possible to override rules on a case by case level w
|
|||
- [Shell](#shell)
|
||||
- [Snakemake](#snakemake)
|
||||
- [SQL](#sql)
|
||||
- [Tekton](#tekton)
|
||||
- [Terraform](#terraform)
|
||||
- [Typescript eslint](#typescript-eslint)
|
||||
- [Typescript standard](#typescript-standard)
|
||||
|
@ -1177,6 +1178,28 @@ shfmt [supports EditorConfig files for configuration](https://github.com/mvdan/s
|
|||
|
||||
---
|
||||
|
||||
## Tekton
|
||||
|
||||
- [Tekton](https://github.com/IBM/tekton-lint)
|
||||
|
||||
### Tekton Config file
|
||||
|
||||
- There is currently **No** Tekton format config rules file
|
||||
|
||||
### Tekton disable single line
|
||||
|
||||
- There is currently **No** way to disable rules inline of the file(s)
|
||||
|
||||
### Tekton disable code block
|
||||
|
||||
- There is currently **No** way to disable rules inline of the file(s)
|
||||
|
||||
### Tekton disable entire file
|
||||
|
||||
- There is currently **No** way to disable rules inline of the file(s)
|
||||
|
||||
---
|
||||
|
||||
## Terraform
|
||||
|
||||
- [tflint](https://github.com/terraform-linters/tflint)
|
||||
|
|
|
@ -495,6 +495,16 @@ function BuildFileList() {
|
|||
FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
|
||||
fi
|
||||
|
||||
########################################
|
||||
# Check if the file is Tekton template #
|
||||
########################################
|
||||
if DetectTektonFile "${FILE}"; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
################################
|
||||
FILE_ARRAY_TEKTON+=("${FILE}")
|
||||
fi
|
||||
|
||||
############################################
|
||||
# Check if the file is Kubernetes template #
|
||||
############################################
|
||||
|
|
|
@ -172,8 +172,8 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'BASH_EXEC' 'CLOUDFORMATION' 'CLOJURE' 'C
|
|||
'DART' 'DOCKERFILE' 'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GO' 'GROOVY' 'HTML'
|
||||
'JAVA' 'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KUBERNETES_KUBEVAL' 'KOTLIN' 'LATEX' 'LUA' 'MARKDOWN'
|
||||
'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN' 'PHP_PSALM' 'POWERSHELL'
|
||||
'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'R' 'RAKU' 'RUBY' 'SHELL_SHFMT' 'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT' 'STATES' 'SQL' 'TERRAFORM'
|
||||
'TERRAFORM_TERRASCAN' 'TERRAGRUNT' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
||||
'PROTOBUF' 'PYTHON_BLACK' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'R' 'RAKU' 'RUBY' 'SHELL_SHFMT' 'SNAKEMAKE_LINT' 'SNAKEMAKE_SNAKEFMT' 'STATES' 'SQL'
|
||||
'TEKTON' 'TERRAFORM' 'TERRAFORM_TERRASCAN' 'TERRAGRUNT' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
||||
|
||||
##############################
|
||||
# Linter command names array #
|
||||
|
@ -224,6 +224,7 @@ LINTER_NAMES_ARRAY['SNAKEMAKE_LINT']="snakemake"
|
|||
LINTER_NAMES_ARRAY['SNAKEMAKE_SNAKEFMT']="snakefmt"
|
||||
LINTER_NAMES_ARRAY['STATES']="asl-validator"
|
||||
LINTER_NAMES_ARRAY['SQL']="sql-lint"
|
||||
LINTER_NAMES_ARRAY['TEKTON']="tekton-lint"
|
||||
LINTER_NAMES_ARRAY['TERRAFORM']="tflint"
|
||||
LINTER_NAMES_ARRAY['TERRAFORM_TERRASCAN']="terrascan"
|
||||
LINTER_NAMES_ARRAY['TERRAGRUNT']="terragrunt"
|
||||
|
@ -548,6 +549,39 @@ DetectOpenAPIFile() {
|
|||
fi
|
||||
}
|
||||
################################################################################
|
||||
#### Function DetectTektonFile #################################################
|
||||
DetectTektonFile() {
|
||||
################
|
||||
# Pull in vars #
|
||||
################
|
||||
FILE="${1}"
|
||||
|
||||
###############################
|
||||
# Check the file for keywords #
|
||||
###############################
|
||||
grep -q -E 'apiVersion: tekton' "${FILE}" >/dev/null
|
||||
|
||||
#######################
|
||||
# Load the error code #
|
||||
#######################
|
||||
ERROR_CODE=$?
|
||||
|
||||
##############################
|
||||
# Check the shell for errors #
|
||||
##############################
|
||||
if [ ${ERROR_CODE} -eq 0 ]; then
|
||||
########################
|
||||
# Found string in file #
|
||||
########################
|
||||
return 0
|
||||
else
|
||||
###################
|
||||
# No string match #
|
||||
###################
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
################################################################################
|
||||
#### Function DetectARMFile ####################################################
|
||||
DetectARMFile() {
|
||||
################
|
||||
|
@ -1151,6 +1185,7 @@ LINTER_COMMANDS_ARRAY['SNAKEMAKE_LINT']="snakemake --lint -s"
|
|||
LINTER_COMMANDS_ARRAY['SNAKEMAKE_SNAKEFMT']="snakefmt --config ${SNAKEMAKE_SNAKEFMT_LINTER_RULES} --check --compact-diff"
|
||||
LINTER_COMMANDS_ARRAY['STATES']="asl-validator --json-path"
|
||||
LINTER_COMMANDS_ARRAY['SQL']="sql-lint --config ${SQL_LINTER_RULES}"
|
||||
LINTER_COMMANDS_ARRAY['TEKTON']="tekton-lint"
|
||||
LINTER_COMMANDS_ARRAY['TERRAFORM']="tflint -c ${TERRAFORM_LINTER_RULES}"
|
||||
LINTER_COMMANDS_ARRAY['TERRAFORM_TERRASCAN']="terrascan scan -p /root/.terrascan/pkg/policies/opa/rego/ -t aws -f "
|
||||
LINTER_COMMANDS_ARRAY['TERRAGRUNT']="terragrunt hclfmt --terragrunt-check --terragrunt-hclfmt-file "
|
||||
|
@ -1160,7 +1195,6 @@ LINTER_COMMANDS_ARRAY['TYPESCRIPT_STANDARD']="standard --parser @typescript-esli
|
|||
LINTER_COMMANDS_ARRAY['XML']="xmllint"
|
||||
LINTER_COMMANDS_ARRAY['YAML']="yamllint -c ${YAML_LINTER_RULES}"
|
||||
|
||||
|
||||
##################################
|
||||
# Get and print all version info #
|
||||
##################################
|
||||
|
|
|
@ -25,7 +25,7 @@ LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'bash-exec' 'black' 'cfn-
|
|||
'dotnet-format' 'dart' 'dockerfilelint' 'dotenv-linter' 'editorconfig-checker' 'eslint' 'flake8' 'golangci-lint'
|
||||
'hadolint' 'htmlhint' 'jsonlint' 'kubeval' 'ktlint' 'lintr' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint'
|
||||
'pwsh' 'pylint' 'raku' 'rubocop' 'shellcheck' 'shfmt' 'spectral' 'standard' 'stylelint' 'sql-lint'
|
||||
'terrascan' 'tflint' 'xmllint' 'yamllint')
|
||||
'tekton-lint' 'terrascan' 'tflint' 'xmllint' 'yamllint')
|
||||
|
||||
################################################################################
|
||||
########################## FUNCTIONS BELOW #####################################
|
||||
|
|
|
@ -692,6 +692,7 @@ function RunTestCases() {
|
|||
TestCodebase "SNAKEMAKE_SNAKEFMT" "snakefmt" "snakefmt --config ${SNAKEMAKE_SNAKEFMT_LINTER_RULES} --check --compact-diff" ".*\.\(smk\)\$" "snakemake"
|
||||
TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states"
|
||||
TestCodebase "SQL" "sql-lint" "sql-lint --config ${SQL_LINTER_RULES}" ".*\.\(sql\)\$" "sql"
|
||||
TestCodebase "TEKTON" "tekton-lint" "tekton-lint" ".*\.\(yml\|yaml\)\$" "tekton"
|
||||
TestCodebase "TERRAFORM" "tflint" "tflint -c ${TERRAFORM_LINTER_RULES}" ".*\.\(tf\)\$" "terraform"
|
||||
TestCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan scan -p /root/.terrascan/pkg/policies/opa/rego/ -t aws -f " ".*\.\(tf\)\$" "terraform_terrascan"
|
||||
TestCodebase "TERRAGRUNT" "terragrunt" "terragrunt hclfmt --terragrunt-check --terragrunt-hclfmt-file " ".*\.\(hcl\)\$" "terragrunt"
|
||||
|
|
Loading…
Reference in a new issue