From 081e267c15a77104434f980190c57491a1f16b70 Mon Sep 17 00:00:00 2001 From: Grachev Mikhail Date: Sat, 20 Jun 2020 13:02:14 +0300 Subject: [PATCH 1/2] Add support more variants names of env files Update linter.sh Update Dockerfile Update linter.sh --- Dockerfile | 4 ++-- lib/linter.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index a93c72bc..4d2c7908 100644 --- a/Dockerfile +++ b/Dockerfile @@ -102,9 +102,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 diff --git a/lib/linter.sh b/lib/linter.sh index ca88f558..4b174c18 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1020,9 +1020,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 @@ -2050,7 +2050,7 @@ RunTestCases() TestCodebase "ANSIBLE" "ansible-lint" "ansible-lint -v -c $ANSIBLE_LINTER_RULES" "ansible-lint" TestCodebase "TERRAFORM" "tflint" "tflint -c $TERRAFORM_LINTER_RULES" ".*\.\(tf\)\$" 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 # @@ -2336,15 +2336,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 ################## From 22b7a7f073fba60feea4b79f2e5c7b2fc4fd8679 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Mon, 22 Jun 2020 13:55:41 -0500 Subject: [PATCH 2/2] fix rubocop logic --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4d2c7908..58e6444b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -82,7 +82,10 @@ RUN gem install rubocop:0.74.0 rubocop-rails rubocop-github:0.13.0 # Need to fix the version as it installs 'rubocop:0.85.1' as a dep, and forces the default # We then need to promot the correct verion, uninstall, and fix deps -RUN sh -c 'gem install --default rubocop:0.74.0; yes | gem uninstall rubocop:0.85.1 -a -x -I; gem install rubocop:0.74.0' +RUN sh -c 'INCORRECT_VERSION=$(gem list rhc -e rubocop | grep rubocop | awk "{print $2}" | cut -d"(" -f2 | cut -d"," -f1); \ + gem install --default rubocop:0.74.0; \ + yes | gem uninstall rubocop:$INCORRECT_VERSION -a -x -I; \ + gem install rubocop:0.74.0' ###################### # Install shellcheck #