mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-25 02:01:02 -05:00
Saving it
This commit is contained in:
parent
e3cd76f9df
commit
c9ef1fcb66
9 changed files with 74 additions and 2 deletions
19
.automation/test/sql/README.md
Normal file
19
.automation/test/sql/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# SQL Test Cases
|
||||
|
||||
This folder holds the test cases for **SQL**.
|
||||
|
||||
## 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.
|
1
.automation/test/sql/sql_bad_1.sql
Normal file
1
.automation/test/sql/sql_bad_1.sql
Normal file
|
@ -0,0 +1 @@
|
|||
DELETE from person;
|
1
.automation/test/sql/sql_good_1.sql
Normal file
1
.automation/test/sql/sql_good_1.sql
Normal file
|
@ -0,0 +1 @@
|
|||
DELETE from person WHERE 1=1;
|
|
@ -291,6 +291,7 @@ ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \
|
|||
VALIDATE_RAKU=${VALIDATE_RAKU} \
|
||||
VALIDATE_RUBY=${VALIDATE_RUBY} \
|
||||
VALIDATE_STATES=${VALIDATE_STATES} \
|
||||
VALIDATE_SQL=${VALIDATE_SQL} \
|
||||
VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \
|
||||
VALIDATE_TERRAFORM_TERRASCAN=${VALIDATE_TERRAFORM_TERRASCAN} \
|
||||
VALIDATE_TYPESCRIPT_ES=${VALIDATE_TYPESCRIPT_ES} \
|
||||
|
|
|
@ -71,6 +71,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base
|
|||
| **Raku** | [raku](https://raku.org) |
|
||||
| **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) |
|
||||
| **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) |
|
||||
| **SQL** | [sql-lint](https://github.com/joereynolds/sql-lint) |
|
||||
| **Terraform** | [tflint](https://github.com/terraform-linters/tflint) [terrascan](https://github.com/accurics/terrascan) |
|
||||
| **TypeScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) |
|
||||
| **XML** | [LibXML](http://xmlsoft.org/) |
|
||||
|
@ -226,6 +227,7 @@ and won't run anything unexpected.
|
|||
| **VALIDATE_RAKU** | `true` | Flag to enable or disable the linting process of the Raku language. |
|
||||
| **VALIDATE_RUBY** | `true` | Flag to enable or disable the linting process of the Ruby language. |
|
||||
| **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_TERRAFORM** | `true` | Flag to enable or disable the linting process of the Terraform language. |
|
||||
| **VALIDATE_TERRAFORM_TERRASCAN** | `false` | Flag to enable or disable the linting process of the Terraform language for security related issues. |
|
||||
| **VALIDATE_TSX** | `true` | Flag to enable or disable the linting process for tsx files (Utilizing: eslint) |
|
||||
|
|
|
@ -45,6 +45,7 @@ For some linters it is also possible to override rules on a case by case level w
|
|||
- [Raku](#raku)
|
||||
- [Ruby](#ruby)
|
||||
- [Shell](#shell)
|
||||
- [SQL](#sql)
|
||||
- [Terraform](#terraform)
|
||||
- [Typescript eslint](#typescript-eslint)
|
||||
- [Typescript standard](#typescript-standard)
|
||||
|
@ -1010,6 +1011,28 @@ moreThings()
|
|||
|
||||
---
|
||||
|
||||
## SQL
|
||||
|
||||
- [SQL](https://www.npmjs.com/package/sql-lint)
|
||||
|
||||
### SQL Config file
|
||||
|
||||
- There is no top level _configuration file_ available at this time
|
||||
|
||||
### SQL disable single line
|
||||
|
||||
- There is currently **No** way to disable rules inline of the file(s)
|
||||
|
||||
### SQL disable code block
|
||||
|
||||
- There is currently **No** way to disable rules inline of the file(s)
|
||||
|
||||
### SQL disable entire file
|
||||
|
||||
- There is currently **No** way to disable rules inline of the file(s)
|
||||
|
||||
---
|
||||
|
||||
## Terraform
|
||||
|
||||
- [tflint](https://github.com/terraform-linters/tflint)
|
||||
|
|
|
@ -457,6 +457,15 @@ function BuildFileList() {
|
|||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
READ_ONLY_CHANGE_FLAG=1
|
||||
elif [ "${FILE_TYPE}" == "sql" ]; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
##############################p##
|
||||
FILE_ARRAY_SQL+=("${FILE}")
|
||||
##########################################################
|
||||
# Set the READ_ONLY_CHANGE_FLAG since this could be exec #
|
||||
##########################################################
|
||||
READ_ONLY_CHANGE_FLAG=1
|
||||
elif [ "$FILE_TYPE" == "groovy" ] || [ "$FILE_TYPE" == "jenkinsfile" ] || [ "$FILE_TYPE" == "gradle" ]; then
|
||||
################################
|
||||
# Append the file to the array #
|
||||
|
|
|
@ -127,7 +127,7 @@ YAML_LINTER_RULES="${DEFAULT_RULES_LOCATION}/${YAML_FILE_NAME}" # Path to the ya
|
|||
LINTER_ARRAY=('ansible-lint' 'arm-ttk' 'asl-validator' 'cfn-lint' 'checkstyle' 'clj-kondo' 'coffeelint'
|
||||
'dart' 'dockerfilelint' 'dotenv-linter' 'eslint' 'flake8' 'golangci-lint' 'hadolint' 'htmlhint'
|
||||
'jsonlint' 'ktlint' 'lua' 'markdownlint' 'npm-groovy-lint' 'perl' 'protolint' 'pwsh'
|
||||
'pylint' 'raku' 'rubocop' 'shellcheck' 'spectral' 'standard' 'stylelint' 'terrascan'
|
||||
'pylint' 'raku' 'rubocop' 'shellcheck' 'spectral' 'standard' 'stylelint' 'sql-lint' 'terrascan'
|
||||
'tflint' 'xmllint' 'yamllint')
|
||||
|
||||
#############################
|
||||
|
@ -137,7 +137,7 @@ LANGUAGE_ARRAY=('ANSIBLE' 'ARM' 'BASH' 'CLOUDFORMATION' 'CLOJURE' 'COFFEESCRIPT'
|
|||
'DART' 'DOCKERFILE' 'DOCKERFILE_HADOLINT' 'EDITORCONFIG' 'ENV' 'GO' 'GROOVY' 'HTML'
|
||||
'JAVA' 'JAVASCRIPT_ES' 'JAVASCRIPT_STANDARD' 'JSON' 'JSX' 'KOTLIN' 'LUA' 'MARKDOWN'
|
||||
'OPENAPI' 'PERL' 'PHP_BUILTIN' 'PHP_PHPCS' 'PHP_PHPSTAN' 'PHP_PSALM' 'POWERSHELL'
|
||||
'PROTOBUF' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'RAKU' 'RUBY' 'STATES' 'TERRAFORM'
|
||||
'PROTOBUF' 'PYTHON_PYLINT' 'PYTHON_FLAKE8' 'RAKU' 'RUBY' 'STATES' 'SQL' 'TERRAFORM'
|
||||
'TERRAFORM_TERRASCAN' 'TSX' 'TYPESCRIPT_ES' 'TYPESCRIPT_STANDARD' 'XML' 'YAML')
|
||||
|
||||
############################################
|
||||
|
@ -197,6 +197,7 @@ VALIDATE_PYTHON_FLAKE8="${VALIDATE_PYTHON_FLAKE8}" # Boolean t
|
|||
VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean to validate language
|
||||
VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language
|
||||
VALIDATE_STATES="${VALIDATE_STATES}" # Boolean to validate language
|
||||
VALIDATE_SQL="${VALIDATE_SQL}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language
|
||||
VALIDATE_TERRAFORM_TERRASCAN="${VALIDATE_TERRAFORM_TERRASCAN}" # Boolean to validate language
|
||||
VALIDATE_TSX="${VALIDATE_TSX}" # Boolean to validate language
|
||||
|
@ -294,6 +295,7 @@ FILE_ARRAY_PYTHON_FLAKE8=() # Array of files to check
|
|||
FILE_ARRAY_RAKU=() # Array of files to check
|
||||
FILE_ARRAY_RUBY=() # Array of files to check
|
||||
FILE_ARRAY_STATES=() # Array of files to check
|
||||
FILE_ARRAY_SQL=() # Array of files to check
|
||||
FILE_ARRAY_TERRAFORM=() # Array of files to check
|
||||
FILE_ARRAY_TSX=() # Array of files to check
|
||||
FILE_ARRAY_TYPESCRIPT_ES=() # Array of files to check
|
||||
|
@ -376,6 +378,8 @@ ERRORS_FOUND_RUBY=0 # Count of errors found
|
|||
export ERRORS_FOUND_RUBY # Workaround SC2034
|
||||
ERRORS_FOUND_STATES=0 # Count of errors found
|
||||
export ERRORS_FOUND_STATES # Workaround SC2034
|
||||
ERRORS_FOUND_SQL=0 # Count of errors found
|
||||
export ERRORS_FOUND_SQL # Workaround SC2034
|
||||
ERRORS_FOUND_TERRAFORM=0 # Count of errors found
|
||||
export ERRORS_FOUND_TERRAFORM # Workaround SC2034
|
||||
ERRORS_FOUND_TERRAFORM_TERRASCAN=0 # Count of errors found
|
||||
|
@ -1724,6 +1728,17 @@ if [ "${VALIDATE_STATES}" == "true" ]; then
|
|||
LintCodebase "STATES" "asl-validator" "asl-validator --json-path" "disabledfileext" "${FILE_ARRAY_STATES[@]}"
|
||||
fi
|
||||
|
||||
###############
|
||||
# SQL LINTING #
|
||||
###############
|
||||
if [ "${VALIDATE_SQL}" == "true" ]; then
|
||||
######################
|
||||
# Lint the SQL files #
|
||||
######################
|
||||
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
|
||||
LintCodebase "SQL" "sql-lint" "sql-lint" ".*\.\(sql\)\$" "${FILE_ARRAY_SQL[@]}"
|
||||
fi
|
||||
|
||||
#####################
|
||||
# TERRAFORM LINTING #
|
||||
#####################
|
||||
|
|
|
@ -603,6 +603,7 @@ function RunTestCases() {
|
|||
TestCodebase "RAKU" "raku" "raku -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "raku"
|
||||
TestCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES}" ".*\.\(rb\)\$" "ruby"
|
||||
TestCodebase "STATES" "asl-validator" "asl-validator --json-path" ".*\.\(json\)\$" "states"
|
||||
TestCodebase "SQL" "sql-lint" "sql-lint" ".*\.\(sql\)\$" "sql"
|
||||
TestCodebase "TERRAFORM" "tflint" "tflint -c ${TERRAFORM_LINTER_RULES}" ".*\.\(tf\)\$" "terraform"
|
||||
TestCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan -f " ".*\.\(tf\)\$" "terraform_terrascan"
|
||||
TestCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${TYPESCRIPT_LINTER_RULES}" ".*\.\(ts\)\$" "typescript"
|
||||
|
|
Loading…
Reference in a new issue