From 1e453be7fa22a2df9c4858b0dc5e22ef544b422f Mon Sep 17 00:00:00 2001 From: kpj Date: Mon, 7 Sep 2020 16:49:07 +0200 Subject: [PATCH] [Snakemake] Update codebase --- .github/linters/.snakefmt.toml | 0 Dockerfile | 1 + TEMPLATES/.snakefmt.toml | 0 lib/buildFileList.sh | 13 +++++++++++++ lib/linter.sh | 14 ++++++++++++++ 5 files changed, 28 insertions(+) create mode 100644 .github/linters/.snakefmt.toml create mode 100644 TEMPLATES/.snakefmt.toml diff --git a/.github/linters/.snakefmt.toml b/.github/linters/.snakefmt.toml new file mode 100644 index 00000000..e69de29b diff --git a/Dockerfile b/Dockerfile index 7b737996..e0fcaafa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -380,6 +380,7 @@ ENV ACTIONS_RUNNER_DEBUG=${ACTIONS_RUNNER_DEBUG} \ VALIDATE_RAKU=${VALIDATE_RAKU} \ VALIDATE_RUBY=${VALIDATE_RUBY} \ VALIDATE_SHELL_SHFMT=${VALIDATE_SHELL_SHFMT} \ + VALIDATE_SNAKEMAKE=${VALIDATE_SNAKEMAKE} \ VALIDATE_STATES=${VALIDATE_STATES} \ VALIDATE_SQL=${VALIDATE_SQL} \ VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \ diff --git a/TEMPLATES/.snakefmt.toml b/TEMPLATES/.snakefmt.toml new file mode 100644 index 00000000..e69de29b diff --git a/lib/buildFileList.sh b/lib/buildFileList.sh index 13371ef6..a8452a2f 100755 --- a/lib/buildFileList.sh +++ b/lib/buildFileList.sh @@ -484,6 +484,19 @@ function BuildFileList() { ########################################################## READ_ONLY_CHANGE_FLAG=1 + ########################### + # Get the SNAKEMAKE files # + ########################### + elif [ "${FILE_TYPE}" == "smk" ]; then + ################################ + # Append the file to the array # + ################################ + FILE_ARRAY_SNAKEMAKE+=("${FILE}") + ########################################################## + # Set the READ_ONLY_CHANGE_FLAG since this could be exec # + ########################################################## + READ_ONLY_CHANGE_FLAG=1 + ##################### # Get the SQL files # ##################### diff --git a/lib/linter.sh b/lib/linter.sh index 78d2f5bf..11bc1f43 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -207,6 +207,7 @@ VALIDATE_RAKU="${VALIDATE_RAKU}" # Boolean t VALIDATE_RUBY="${VALIDATE_RUBY}" # Boolean to validate language VALIDATE_STATES="${VALIDATE_STATES}" # Boolean to validate language VALIDATE_SHELL_SHFMT="${VALIDATE_SHELL_SHFMT}" # Boolean to check Shell files against editorconfig +VALIDATE_SNAKEMAKE="${VALIDATE_SNAKEMAKE}" # Boolean to check Snakefiles 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 @@ -1846,6 +1847,19 @@ if [ "${VALIDATE_SHELL_SHFMT}" == "true" ]; then fi fi +##################### +# SNAKEMAKE LINTING # +##################### +if [ "${VALIDATE_SNAKEMAKE}" == "true" ]; then + ################################ + # Lint the files with snakefmt # + ################################ + # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" + LintCodebase "SNAKEMAKE" "snakefmt" "snakefmt --diff" ".*\.\(smk\)\$" "${FILE_ARRAY_SNAKEMAKE[@]}" + + # TODO: add --config +fi + ###################### # AWS STATES LINTING # ######################