Merge pull request #242 from github/BetterEnv

Add support more variants names of env files
This commit is contained in:
Lukas Gravley 2020-06-22 14:20:19 -05:00 committed by GitHub
commit e14a91db93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -123,9 +123,9 @@ RUN wget -O- -nvq https://raw.githubusercontent.com/golangci/golangci-lint/maste
RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" -o tflint.zip && unzip tflint.zip && rm tflint.zip \
&& mv "tflint" /usr/bin/
##################
#########################
# Install dotenv-linter #
##################
#########################
RUN wget "https://github.com/dotenv-linter/dotenv-linter/releases/latest/download/dotenv-linter-alpine-x86_64.tar.gz" -O - -q | tar -xzf - \
&& mv "dotenv-linter" /usr/bin

View file

@ -1042,9 +1042,9 @@ GetValidationInfo()
VALIDATE_CSS="true"
fi
####################################
###################################
# Validate if we should check ENV #
####################################
###################################
if [[ "$ANY_SET" == "true" ]]; then
# Some linter flags were set - only run those set to true
if [[ -z "$VALIDATE_ENV" ]]; then
@ -2109,7 +2109,7 @@ RunTestCases()
TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$"
TestCodebase "POWERSHELL" "pwsh" "pwsh -c Invoke-ScriptAnalyzer -EnableExit -Settings $POWERSHELL_LINTER_RULES -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$"
TestCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$"
TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$"
TestCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\).*\$"
#################
# Footer prints #
@ -2397,15 +2397,15 @@ if [ "$VALIDATE_CSS" == "true" ]; then
LintCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" "${FILE_ARRAY_CSS[@]}"
fi
################
###############
# ENV LINTING #
################
###############
if [ "$VALIDATE_ENV" == "true" ]; then
#######################
# Lint the env files #
#######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY"
LintCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\)\$" "${FILE_ARRAY_ENV[@]}"
LintCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\).*\$" "${FILE_ARRAY_ENV[@]}"
fi
##################