Merge branch 'master' into patch-2

This commit is contained in:
Lucas Gravley 2020-10-08 08:47:45 -05:00
commit ae512c87d0
9 changed files with 258 additions and 573 deletions

View file

@ -78,7 +78,7 @@ ARG GLIBC_VERSION='2.31-r0'
#################### ####################
# Run APK installs # # Run APK installs #
#################### ####################
RUN apk add --update --no-cache \ RUN apk add --no-cache \
ansible-lint \ ansible-lint \
bash \ bash \
coreutils \ coreutils \
@ -264,7 +264,7 @@ RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: Fil
################################################# #################################################
# Basic setup, programs and init # Basic setup, programs and init
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \
&& apk add --update --no-cache rakudo zef && apk add --no-cache rakudo zef
###################### ######################
# Install CheckStyle # # Install CheckStyle #

View file

@ -209,7 +209,6 @@ But if you wish to select or exclude specific linters, we give you full control
| **FILTER_REGEX_EXCLUDE** | `none` | Regular expression defining which files will be excluded from linting (ex: `.*src/test.*`) | | **FILTER_REGEX_EXCLUDE** | `none` | Regular expression defining which files will be excluded from linting (ex: `.*src/test.*`) |
| **FILTER_REGEX_INCLUDE** | `all` | Regular expression defining which files will be processed by linters (ex: `.*src/.*`) | | **FILTER_REGEX_INCLUDE** | `all` | Regular expression defining which files will be processed by linters (ex: `.*src/.*`) |
| **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`) | | **JAVASCRIPT_ES_CONFIG_FILE** | `.eslintrc.yml` | Filename for [eslint configuration](https://eslint.org/docs/user-guide/configuring#configuration-file-formats) (ex: `.eslintrc.yml`, `.eslintrc.json`) |
| **KUBERNETES_DIRECTORY** | `/kubernetes` | The path to the root directory for Kubernetes descriptors, relative to `DEFAULT_WORKSPACE`. |
| **LINTER_RULES_PATH** | `.github/linters` | Directory for all linter configuration rules. | | **LINTER_RULES_PATH** | `.github/linters` | Directory for all linter configuration rules. |
| **LOG_FILE** | `super-linter.log` | The file name for outputting logs. All output is sent to the log file regardless of `LOG_LEVEL`. | | **LOG_FILE** | `super-linter.log` | The file name for outputting logs. All output is sent to the log file regardless of `LOG_LEVEL`. |
| **LOG_LEVEL** | `VERBOSE` | How much output the script will generate to the console. One of `VERBOSE`, `DEBUG` or `TRACE`. | | **LOG_LEVEL** | `VERBOSE` | How much output the script will generate to the console. One of `VERBOSE`, `DEBUG` or `TRACE`. |
@ -251,7 +250,7 @@ But if you wish to select or exclude specific linters, we give you full control
| **VALIDATE_KUBERNETES_KUBEVAL** | `true` | Flag to enable or disable the linting process of Kubernetes descriptors with Kubeval | | **VALIDATE_KUBERNETES_KUBEVAL** | `true` | Flag to enable or disable the linting process of Kubernetes descriptors with Kubeval |
| **VALIDATE_LATEX** | `true` | Flag to enable or disable the linting process of the LaTeX language. | | **VALIDATE_LATEX** | `true` | Flag to enable or disable the linting process of the LaTeX language. |
| **VALIDATE_LUA** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_LUA** | `true` | Flag to enable or disable the linting process of the language. |
| **VALIDATE_MD** | `true` | Flag to enable or disable the linting process of the Markdown language. | | **VALIDATE_MARKDOWN** | `true` | Flag to enable or disable the linting process of the Markdown language. |
| **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the OpenAPI language. | | **VALIDATE_OPENAPI** | `true` | Flag to enable or disable the linting process of the OpenAPI language. |
| **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the Perl language. | | **VALIDATE_PERL** | `true` | Flag to enable or disable the linting process of the Perl language. |
| **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the PHP language. (Utilizing: PHP built-in linter) (keep for backward compatibility) | | **VALIDATE_PHP** | `true` | Flag to enable or disable the linting process of the PHP language. (Utilizing: PHP built-in linter) (keep for backward compatibility) |

52
dependencies/Pipfile.lock generated vendored
View file

@ -18,9 +18,10 @@
"default": { "default": {
"amply": { "amply": {
"hashes": [ "hashes": [
"sha256:6e5d53af62772790ba82a989a3de72b8ce5c1cd809613c06f7cb061f7ec34dc8" "sha256:cb12dcb49d16b168c02be128a1527ecde50211e4bd94af76ff4e67707f5a2d38",
"sha256:f8a846a544750493f45e75e9b44c393144be5728701df4f596b1fa5595d263fd"
], ],
"version": "==0.1.2" "version": "==0.1.4"
}, },
"appdirs": { "appdirs": {
"hashes": [ "hashes": [
@ -68,17 +69,16 @@
}, },
"boto3": { "boto3": {
"hashes": [ "hashes": [
"sha256:02f5f7a2b1349760b030c34f90a9cb4600bf8fe3cbc76b801d122bc4cecf3a7f", "sha256:329178bd505b5d1dbb5eab25e9697c0e592c45548c895f451a91772d0e5a9329"
"sha256:e0a1dbc0a0e460dc6de2f4144b5015edad3ab5c17ee83c6194b1a010d815bc60"
], ],
"version": "==1.15.9" "version": "==1.15.13"
}, },
"botocore": { "botocore": {
"hashes": [ "hashes": [
"sha256:35b06b8801eb2dd7e708de35581f9c0304740645874f3af5b8b0c1648f8d6365", "sha256:570609095c992732cf6158c3dd0a38619c77818fa700d6779b27277b34f98959",
"sha256:dc3244170254cbba7dfde00b0489f830069d93dd6a9e555178d989072d7ee7c2" "sha256:90e76683807896a28bbefd6e9bc3a2dc44ecd88fc6f6737fa0e3b20d5b7223ea"
], ],
"version": "==1.18.9" "version": "==1.18.13"
}, },
"certifi": { "certifi": {
"hashes": [ "hashes": [
@ -89,11 +89,11 @@
}, },
"cfn-lint": { "cfn-lint": {
"hashes": [ "hashes": [
"sha256:0e219f5affa2ed24cd588faf599eeef1a2b32172572708a52dbba0ec5517cd9a", "sha256:2b47c74df569ffedd747dfc0535ce40db120d91584f02073a7bd6ab89b24fc97",
"sha256:5178595b7ccbbafb8b2b6fe9d3bc6215007387145ddf29812ecee70bb8500801" "sha256:38973fb861986270b9ecaa72aa65b26f21bf8c14c075a3dd8b584b2b3a164dad"
], ],
"index": "pypi", "index": "pypi",
"version": "==0.37.0" "version": "==0.37.1"
}, },
"chardet": { "chardet": {
"hashes": [ "hashes": [
@ -161,11 +161,11 @@
}, },
"flake8": { "flake8": {
"hashes": [ "hashes": [
"sha256:15e351d19611c887e482fb960eae4d44845013cc142d42896e9862f775d8cf5c", "sha256:749dbbd6bfd0cf1318af27bf97a14e28e5ff548ef8e5b1566ccfb25a11e7c839",
"sha256:f04b9fcbac03b0a3e58c0ab3a0ecc462e023a9faf046d57794184028123aa208" "sha256:aadae8761ec651813c24be05c6f7b4680857ef6afaae4651a4eccaef97ce6c3b"
], ],
"index": "pypi", "index": "pypi",
"version": "==3.8.3" "version": "==3.8.4"
}, },
"gitdb": { "gitdb": {
"hashes": [ "hashes": [
@ -399,12 +399,17 @@
"hashes": [ "hashes": [
"sha256:088afc8c63e7bd187a3c70a94b9e50ab3f17e1d3f52a32750b5b77dbe99ef5ef", "sha256:088afc8c63e7bd187a3c70a94b9e50ab3f17e1d3f52a32750b5b77dbe99ef5ef",
"sha256:1fe0a41437bbd06063aa184c34804efa886bcc128222e9916310c92cd54c3b4c", "sha256:1fe0a41437bbd06063aa184c34804efa886bcc128222e9916310c92cd54c3b4c",
"sha256:3d20024a70b97b4f9546696cbf2fd30bae5f42229fbddf8661261b1eaff0deb7",
"sha256:41bb65f54bba392643557e617316d0d899ed5b4946dccee1cb6696152b29844b", "sha256:41bb65f54bba392643557e617316d0d899ed5b4946dccee1cb6696152b29844b",
"sha256:4318d56bccfe7d43e5addb272406ade7a2274da4b70eb15922a071c58ab0108c", "sha256:4318d56bccfe7d43e5addb272406ade7a2274da4b70eb15922a071c58ab0108c",
"sha256:4707f3695b34335afdfb09be3802c87fa0bc27030471dbc082f815f23688bc63", "sha256:4707f3695b34335afdfb09be3802c87fa0bc27030471dbc082f815f23688bc63",
"sha256:49f23ebd5ac073765ecbcf046edc10d63dcab2f4ae2bce160982cb30df0c0302",
"sha256:5533a959a1748a5c042a6da71fe9267a908e21eded7a4f373efd23a2cbdb0ecc", "sha256:5533a959a1748a5c042a6da71fe9267a908e21eded7a4f373efd23a2cbdb0ecc",
"sha256:5d892a4f1c999834eaa3c32bc9e8b976c5825116cde553928c4c8e7e48ebda67",
"sha256:5f18875ac23d9aa2f060838e8b79093e8bb2313dbaaa9f54c6d8e52a5df097be", "sha256:5f18875ac23d9aa2f060838e8b79093e8bb2313dbaaa9f54c6d8e52a5df097be",
"sha256:60b0e9e6dc45683e569ec37c55ac20c582973841927a85f2d8a7d20ee80216ab", "sha256:60b0e9e6dc45683e569ec37c55ac20c582973841927a85f2d8a7d20ee80216ab",
"sha256:816064fc915796ea1f26966163f6845de5af78923dfcecf6551e095f00983650",
"sha256:84cada8effefe9a9f53f9b0d2ba9b7b6f5edf8d2155f9fdbe34616e06ececf81",
"sha256:84e9407db1b2eb368b7ecc283121b5e592c9aaedbe8c78b1a2f1102eb2e21d19", "sha256:84e9407db1b2eb368b7ecc283121b5e592c9aaedbe8c78b1a2f1102eb2e21d19",
"sha256:8d69cef61fa50c8133382e61fd97439de1ae623fe943578e477e76a9d9471637", "sha256:8d69cef61fa50c8133382e61fd97439de1ae623fe943578e477e76a9d9471637",
"sha256:9a02d0ae31d35e1ec12a4ea4d4cca990800f66a917d0fb997b20fbc13f5321fc", "sha256:9a02d0ae31d35e1ec12a4ea4d4cca990800f66a917d0fb997b20fbc13f5321fc",
@ -412,6 +417,7 @@
"sha256:a6f32aea4260dfe0e55dc9733ea162ea38f0ea86aa7d0f77b15beac5bf7b369d", "sha256:a6f32aea4260dfe0e55dc9733ea162ea38f0ea86aa7d0f77b15beac5bf7b369d",
"sha256:ae91972f8ac958039920ef6e8769277c084971a142ce2b660691793ae44aae6b", "sha256:ae91972f8ac958039920ef6e8769277c084971a142ce2b660691793ae44aae6b",
"sha256:c570f6fa14b9c4c8a4924aaad354652366577b4f98213cf76305067144f7b100", "sha256:c570f6fa14b9c4c8a4924aaad354652366577b4f98213cf76305067144f7b100",
"sha256:c9443124c67b1515e4fe0bb0aa18df640965e1030f468a2a5dc2589b26d130ad",
"sha256:d23a18037313714fb3bb5a94434d3151ee4300bae631894b1ac08111abeaa4a3", "sha256:d23a18037313714fb3bb5a94434d3151ee4300bae631894b1ac08111abeaa4a3",
"sha256:eaf548d117b6737df379fdd53bdde4f08870e66d7ea653e230477f071f861121", "sha256:eaf548d117b6737df379fdd53bdde4f08870e66d7ea653e230477f071f861121",
"sha256:ebbe29186a3d9b0c591e71b7393f1ae08c83cb2d8e517d2a822b8f7ec99dfd8b", "sha256:ebbe29186a3d9b0c591e71b7393f1ae08c83cb2d8e517d2a822b8f7ec99dfd8b",
@ -451,19 +457,19 @@
}, },
"snakefmt": { "snakefmt": {
"hashes": [ "hashes": [
"sha256:6569cf849719b5383261250cf0d82effe0bc57b58f412a196a5daeadfa201ed6", "sha256:632ec6d1765e0eb7e3c4569d6cc0086207dae92c06d7ab379ff55f2ccbb8c6fd",
"sha256:adb3c7a512e4ceff557057e25f87f4792436c17d24db7441722c3e153e89626c" "sha256:e0a5df6cacc37899a5ed47d9e7e0dc39921923cb3f247226d63437df980df95b"
], ],
"index": "pypi", "index": "pypi",
"version": "==0.2.1" "version": "==0.2.2"
}, },
"snakemake": { "snakemake": {
"hashes": [ "hashes": [
"sha256:0ed361c00d2192dd0cb24b1d613456a2e0e65e6c8a6bca7b94d2f980dc5ba075", "sha256:4290ee7bf3917440b098d0eae3bd9d74d92575d3bd47c96fadf14ca43ebd39aa",
"sha256:c6a8a66fe5ee04a074480844ff5ca5d0871143eaa2ad292ed2c7cdc73cdf8fb7" "sha256:94cfed2f47f6441cca6cf9d53cffdc11eb78dd1758d96c0af9cd5e453247363e"
], ],
"index": "pypi", "index": "pypi",
"version": "==5.26.0" "version": "==5.26.1"
}, },
"toml": { "toml": {
"hashes": [ "hashes": [
@ -560,10 +566,10 @@
}, },
"zipp": { "zipp": {
"hashes": [ "hashes": [
"sha256:43f4fa8d8bb313e65d8323a3952ef8756bf40f9a5c3ea7334be23ee4ec8278b6", "sha256:64ad89efee774d1897a58607895d80789c59778ea02185dd846ac38394a8642b",
"sha256:b52f22895f4cfce194bc8172f3819ee8de7540aa6d873535a8668b730b8b411f" "sha256:eed8ec0b8d1416b2ca33516a37a08892442f3954dee131e92cfd92d8fe3e7066"
], ],
"version": "==3.2.0" "version": "==3.3.0"
} }
}, },
"develop": {} "develop": {}

90
dependencies/package-lock.json generated vendored
View file

@ -2332,47 +2332,47 @@
} }
}, },
"eslint-plugin-jest": { "eslint-plugin-jest": {
"version": "24.0.2", "version": "24.1.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.0.2.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.1.0.tgz",
"integrity": "sha512-DSBLNpkKDOpUJQkTGSs5sVJWsu0nDyQ2rYxkr0Eh7nrkc5bMUr/dlDbtTj3l8y6UaCVsem6rryF1OZrKnz1S5g==", "integrity": "sha512-827YJ+E8B9PvXu/0eiVSNFfxxndbKv+qE/3GSMhdorCaeaOehtqHGX2YDW9B85TEOre9n/zscledkFW/KbnyGg==",
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "^4.0.1" "@typescript-eslint/experimental-utils": "^4.0.1"
}, },
"dependencies": { "dependencies": {
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "4.1.1", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.1.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.4.0.tgz",
"integrity": "sha512-jzYsNciHoa4Z3c1URtmeT/bamYm8Dwfw6vuN3WHIE/BXb1iC4KveAnXDErTAZtPVxTYBaYn3n2gbt6F6D2rm1A==", "integrity": "sha512-01+OtK/oWeSJTjQcyzDztfLF1YjvKpLFo+JZmurK/qjSRcyObpIecJ4rckDoRCSh5Etw+jKfdSzVEHevh9gJ1w==",
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.1.1", "@typescript-eslint/scope-manager": "4.4.0",
"@typescript-eslint/types": "4.1.1", "@typescript-eslint/types": "4.4.0",
"@typescript-eslint/typescript-estree": "4.1.1", "@typescript-eslint/typescript-estree": "4.4.0",
"eslint-scope": "^5.0.0", "eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0" "eslint-utils": "^2.0.0"
} }
}, },
"@typescript-eslint/scope-manager": { "@typescript-eslint/scope-manager": {
"version": "4.1.1", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.1.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.4.0.tgz",
"integrity": "sha512-0W8TTobCvIIQ2FsrYTffyZGAAFUyIbEHq5EYJb1m7Rpd005jrnOvKOo8ywCLhs/Bm17C+KsrUboBvBAARQVvyA==", "integrity": "sha512-r2FIeeU1lmW4K3CxgOAt8djI5c6Q/5ULAgdVo9AF3hPMpu0B14WznBAtxrmB/qFVbVIB6fSx2a+EVXuhSVMEyA==",
"requires": { "requires": {
"@typescript-eslint/types": "4.1.1", "@typescript-eslint/types": "4.4.0",
"@typescript-eslint/visitor-keys": "4.1.1" "@typescript-eslint/visitor-keys": "4.4.0"
} }
}, },
"@typescript-eslint/types": { "@typescript-eslint/types": {
"version": "4.1.1", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.1.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.4.0.tgz",
"integrity": "sha512-zrBiqOKYerMTllKcn+BP+i1b7LW/EbMMYytroXMxUTvFPn1smkCu0D7lSAx29fTUO4jnwV0ljSvYQtn2vNrNxA==" "integrity": "sha512-nU0VUpzanFw3jjX+50OTQy6MehVvf8pkqFcURPAE06xFNFenMj1GPEI6IESvp7UOHAnq+n/brMirZdR+7rCrlA=="
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "4.1.1", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.1.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.4.0.tgz",
"integrity": "sha512-2AUg5v0liVBsqbGxBphbJ0QbGqSRVaF5qPoTPWcxop+66vMdU1h4CCvHxTC47+Qb+Pr4l2RhXDd41JNpwcQEKw==", "integrity": "sha512-Fh85feshKXwki4nZ1uhCJHmqKJqCMba+8ZicQIhNi5d5jSQFteWiGeF96DTjO8br7fn+prTP+t3Cz/a/3yOKqw==",
"requires": { "requires": {
"@typescript-eslint/types": "4.1.1", "@typescript-eslint/types": "4.4.0",
"@typescript-eslint/visitor-keys": "4.1.1", "@typescript-eslint/visitor-keys": "4.4.0",
"debug": "^4.1.1", "debug": "^4.1.1",
"globby": "^11.0.1", "globby": "^11.0.1",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
@ -2382,11 +2382,11 @@
} }
}, },
"@typescript-eslint/visitor-keys": { "@typescript-eslint/visitor-keys": {
"version": "4.1.1", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.1.1.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.4.0.tgz",
"integrity": "sha512-/EOOXbA2ferGLG6RmCHEQ0lTTLkOlXYDgblCmQk3tIU7mTPLm4gKhFMeeUSe+bcchTUsKeCk8xcpbop5Zr/8Rw==", "integrity": "sha512-oBWeroUZCVsHLiWRdcTXJB7s1nB3taFY8WGvS23tiAlT6jXVvsdAV4rs581bgdEjOhn43q6ro7NkOiLKu6kFqA==",
"requires": { "requires": {
"@typescript-eslint/types": "4.1.1", "@typescript-eslint/types": "4.4.0",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
} }
}, },
@ -3660,9 +3660,9 @@
"integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA="
}, },
"linkify-it": { "linkify-it": {
"version": "2.2.0", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.2.tgz",
"integrity": "sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==", "integrity": "sha512-gDBO4aHNZS6coiZCKVhSNh43F9ioIL4JwRjLZPkoLIY4yZFwg264Y5lu2x6rb1Js42Gh6Yqm2f6L2AJcnkzinQ==",
"requires": { "requires": {
"uc.micro": "^1.0.1" "uc.micro": "^1.0.1"
} }
@ -3738,13 +3738,13 @@
"integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==" "integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg=="
}, },
"markdown-it": { "markdown-it": {
"version": "10.0.0", "version": "11.0.0",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-11.0.0.tgz",
"integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", "integrity": "sha512-+CvOnmbSubmQFSA9dKz1BRiaSMV7rhexl3sngKqFyXSagoA3fBdJQ8oZWtRy2knXdpDXaBw44euz37DeJQ9asg==",
"requires": { "requires": {
"argparse": "^1.0.7", "argparse": "^1.0.7",
"entities": "~2.0.0", "entities": "~2.0.0",
"linkify-it": "^2.0.0", "linkify-it": "^3.0.1",
"mdurl": "^1.0.1", "mdurl": "^1.0.1",
"uc.micro": "^1.0.5" "uc.micro": "^1.0.5"
} }
@ -3758,17 +3758,17 @@
} }
}, },
"markdownlint": { "markdownlint": {
"version": "0.20.4", "version": "0.21.0",
"resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.20.4.tgz", "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.21.0.tgz",
"integrity": "sha512-jpfaPgjT0OpeBbemjYNZbzGG3hCLcAIvrm/pEY3+q/szDScG6ZonDacqySVRJAv9glbo8y4wBPJ0wgW17+9GGA==", "integrity": "sha512-rTxr0fbCFmS65oxXBD0HNy3/+PSukLS+b7Z6rGDWbjdRJp/e2dKj538r3KTn8oXrusx+ZtuYOozV2Knpnn0pkQ==",
"requires": { "requires": {
"markdown-it": "10.0.0" "markdown-it": "11.0.0"
} }
}, },
"markdownlint-cli": { "markdownlint-cli": {
"version": "0.23.2", "version": "0.24.0",
"resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.23.2.tgz", "resolved": "https://registry.npmjs.org/markdownlint-cli/-/markdownlint-cli-0.24.0.tgz",
"integrity": "sha512-OSl5OZ8xzGN6z355cqRkiq67zPi3reJimklaF72p0554q85Dng5ToOjjSB9tDKZebSt85jX8cp+ruoQlPqOsPA==", "integrity": "sha512-AusUxaX4sFayUBFTCKeHc8+fq73KFqIUW+ZZZYyQ/BvY0MoGAnE2C/3xiawSE7WXmpmguaWzhrXRuY6IrOLX7A==",
"requires": { "requires": {
"commander": "~2.9.0", "commander": "~2.9.0",
"deep-extend": "~0.5.1", "deep-extend": "~0.5.1",
@ -3779,8 +3779,8 @@
"jsonc-parser": "~2.2.0", "jsonc-parser": "~2.2.0",
"lodash.differencewith": "~4.5.0", "lodash.differencewith": "~4.5.0",
"lodash.flatten": "~4.4.0", "lodash.flatten": "~4.4.0",
"markdownlint": "~0.20.4", "markdownlint": "~0.21.0",
"markdownlint-rule-helpers": "~0.11.0", "markdownlint-rule-helpers": "~0.12.0",
"minimatch": "~3.0.4", "minimatch": "~3.0.4",
"minimist": "~1.2.5", "minimist": "~1.2.5",
"rc": "~1.2.7" "rc": "~1.2.7"
@ -3816,9 +3816,9 @@
} }
}, },
"markdownlint-rule-helpers": { "markdownlint-rule-helpers": {
"version": "0.11.0", "version": "0.12.0",
"resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.11.0.tgz", "resolved": "https://registry.npmjs.org/markdownlint-rule-helpers/-/markdownlint-rule-helpers-0.12.0.tgz",
"integrity": "sha512-PhGii9dOiDJDXxiRMpK8N0FM9powprvRPsXALgkjlSPTwLh6ymH+iF3iUe3nq8KGu26tclFBlLL5xAGy/zb7FA==" "integrity": "sha512-Q7qfAk+AJvx82ZY52OByC4yjoQYryOZt6D8TKrZJIwCfhZvcj8vCQNuwDqILushtDBTvGFmUPq+uhOb1KIMi6A=="
}, },
"mathml-tag-names": { "mathml-tag-names": {
"version": "2.1.3", "version": "2.1.3",

View file

@ -11,11 +11,11 @@
"eslint": "^7.10.0", "eslint": "^7.10.0",
"eslint-config-airbnb": "^18.2.0", "eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.12.0", "eslint-config-prettier": "^6.12.0",
"eslint-plugin-jest": "^24.0.2", "eslint-plugin-jest": "^24.1.0",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.1.4",
"htmlhint": "^0.14.1", "htmlhint": "^0.14.1",
"jsonlint": "^1.6.3", "jsonlint": "^1.6.3",
"markdownlint-cli": "^0.23.2", "markdownlint-cli": "^0.24.0",
"npm-groovy-lint": "^7.6.3", "npm-groovy-lint": "^7.6.3",
"prettier": "^2.1.2", "prettier": "^2.1.2",
"prettyjson": "^1.2.1", "prettyjson": "^1.2.1",

View file

@ -10,6 +10,15 @@
################################################################################ ################################################################################
#### Function BuildFileList #################################################### #### Function BuildFileList ####################################################
function BuildFileList() { function BuildFileList() {
debug "Building file list..."
################
# Pull in vars #
################
VALIDATE_ALL_CODEBASE="${1}"
debug "Validate all code base: ${VALIDATE_ALL_CODEBASE}..."
if [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then
# Need to build a list of all files changed # Need to build a list of all files changed
# This can be pulled from the GITHUB_EVENT_PATH payload # This can be pulled from the GITHUB_EVENT_PATH payload
@ -51,6 +60,19 @@ function BuildFileList() {
# Get the Array of files changed in the commits # # Get the Array of files changed in the commits #
################################################# #################################################
mapfile -t RAW_FILE_ARRAY < <(git -C "${GITHUB_WORKSPACE}" diff --name-only "${DEFAULT_BRANCH}...${GITHUB_SHA}" --diff-filter=d 2>&1) mapfile -t RAW_FILE_ARRAY < <(git -C "${GITHUB_WORKSPACE}" diff --name-only "${DEFAULT_BRANCH}...${GITHUB_SHA}" --diff-filter=d 2>&1)
else
################
# print header #
################
debug "----------------------------------------------"
debug "Populating the file list with all the files in the ${GITHUB_WORKSPACE} workspace"
mapfile -t RAW_FILE_ARRAY < <(find "${GITHUB_WORKSPACE}" \
-path "*/node_modules" -prune -o \
-path "*/.git" -prune -o \
-path "*/.venv" -prune -o \
-path "*/.rbenv" -prune -o \
-type f 2>&1)
fi
####################### #######################
# Load the error code # # Load the error code #
@ -69,24 +91,22 @@ function BuildFileList() {
################################################ ################################################
# Iterate through the array of all files found # # Iterate through the array of all files found #
################################################ ################################################
info "----------------------------------------------" info "---------------------------------"
info "------ Files modified in the commit(s): ------" info "------ File list to check: ------"
info "----------------------------------------------" info "---------------------------------"
for FILE in "${RAW_FILE_ARRAY[@]}"; do for FILE in "${RAW_FILE_ARRAY[@]}"; do
# Extract just the file extension # Extract just the file extension
FILE_TYPE="$(GetFileExtension "$FILE")" FILE_TYPE="$(GetFileExtension "$FILE")"
# get the baseFile for additonal logic # get the baseFile for additonal logic, lowercase
BASE_FILE=$(basename "${FILE,,}") BASE_FILE=$(basename "${FILE,,}")
############## ##############
# Print file # # Print file #
############## ##############
info "File:[${FILE}], File_type:[${FILE_TYPE}], Base_file:[${BASE_FILE}]" debug "File:[${FILE}], File_type:[${FILE_TYPE}], Base_file:[${BASE_FILE}]"
######### # Editorconfig-checker should check every file
# DEBUG # FILE_ARRAY_EDITORCONFIG+=("${FILE}")
#########
debug "FILE_TYPE:[${FILE_TYPE}]"
###################### ######################
# Get the shell files # # Get the shell files #
@ -96,6 +116,8 @@ function BuildFileList() {
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_BASH+=("${FILE}") FILE_ARRAY_BASH+=("${FILE}")
FILE_ARRAY_BASH_EXEC+=("${FILE}")
FILE_ARRAY_SHELL_SHFMT+=("${FILE}")
######################### #########################
# Get the CLOJURE files # # Get the CLOJURE files #
@ -147,11 +169,13 @@ function BuildFileList() {
######################## ########################
# Get the DOCKER files # # Get the DOCKER files #
######################## ########################
elif [ "${FILE_TYPE}" == "dockerfile" ] || [[ "${BASE_FILE}" == *"dockerfile."* ]]; then # Use BASE_FILE here because FILE_TYPE is not reliable when there is no file extension
elif [[ "${FILE_TYPE}" != "dockerfilelintrc" ]] && [[ "${BASE_FILE}" == *"dockerfile"* ]]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_DOCKER+=("${FILE}") FILE_ARRAY_DOCKERFILE+=("${FILE}")
FILE_ARRAY_DOCKERFILE_HADOLINT+=("${FILE}")
##################### #####################
# Get the ENV files # # Get the ENV files #
@ -325,7 +349,13 @@ function BuildFileList() {
############################ ############################
# Get the Powershell files # # Get the Powershell files #
############################ ############################
elif [ "${FILE_TYPE}" == "ps1" ]; then elif [ "${FILE_TYPE}" == "ps1" ] ||
[ "${FILE_TYPE}" == "psm1" ] ||
[ "${FILE_TYPE}" == "psd1" ] ||
[ "${FILE_TYPE}" == "ps1xml" ] ||
[ "${FILE_TYPE}" == "pssc" ] ||
[ "${FILE_TYPE}" == "psrc" ] ||
[ "${FILE_TYPE}" == "cdxml" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
@ -347,6 +377,7 @@ function BuildFileList() {
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_PYTHON_BLACK+=("${FILE}")
FILE_ARRAY_PYTHON_PYLINT+=("${FILE}") FILE_ARRAY_PYTHON_PYLINT+=("${FILE}")
FILE_ARRAY_PYTHON_FLAKE8+=("${FILE}") FILE_ARRAY_PYTHON_FLAKE8+=("${FILE}")
@ -382,11 +413,12 @@ function BuildFileList() {
########################### ###########################
# Get the SNAKEMAKE files # # Get the SNAKEMAKE files #
########################### ###########################
elif [ "${FILE_TYPE}" == "smk" ] || [ "${BASE_FILE}" == "Snakefile" ]; then elif [ "${FILE_TYPE}" == "smk" ] || [ "${BASE_FILE}" == "snakefile" ]; then
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_SNAKEMAKE+=("${FILE}") FILE_ARRAY_SNAKEMAKE_LINT+=("${FILE}")
FILE_ARRAY_SNAKEMAKE_SNAKEFMT+=("${FILE}")
##################### #####################
# Get the SQL files # # Get the SQL files #
@ -461,9 +493,8 @@ function BuildFileList() {
################################ ################################
# Append the file to the array # # Append the file to the array #
################################ ################################
FILE_ARRAY_KUBERNETES+=("${FILE}") FILE_ARRAY_KUBERNETES_KUBEVAL+=("${FILE}")
fi fi
######################################################################## ########################################################################
# We have something that we need to try to check file type another way # # We have something that we need to try to check file type another way #
######################################################################## ########################################################################
@ -475,6 +506,7 @@ function BuildFileList() {
fi fi
done done
if [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then
######################################### #########################################
# Need to switch back to branch of code # # Need to switch back to branch of code #
######################################### #########################################
@ -493,6 +525,7 @@ function BuildFileList() {
error "Failed to switch back to branch!" error "Failed to switch back to branch!"
fatal "[${SWITCH2_CMD}]" fatal "[${SWITCH2_CMD}]"
fi fi
fi
################ ################
# Footer print # # Footer print #
@ -534,15 +567,7 @@ function CheckFileType() {
################# #################
GET_FILE_TYPE_CMD="$(GetFileType "$FILE")" GET_FILE_TYPE_CMD="$(GetFileType "$FILE")"
################# if [[ ${GET_FILE_TYPE_CMD} == *"Ruby script"* ]]; then
# Check if bash #
#################
if IsValidShellScript "$FILE"; then
################################
# Append the file to the array #
################################
FILE_ARRAY_BASH+=("${FILE}")
elif [[ ${GET_FILE_TYPE_CMD} == *"Ruby script"* ]]; then
####################### #######################
# It is a Ruby script # # It is a Ruby script #
####################### #######################
@ -619,31 +644,3 @@ function IsValidShellScript() {
trace "$FILE is NOT a supported shell script. Skipping" trace "$FILE is NOT a supported shell script. Skipping"
return 1 return 1
} }
################################################################################
#### Function IsValidShellScript ###############################################
function PopulateShellScriptsList() {
debug "Populating shell script file list. Source: ${GITHUB_WORKSPACE}"
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" \
-path "*/node_modules" -prune -o \
-path "*/.git" -prune -o \
-path "*/.venv" -prune -o \
-path "*/.rbenv" -prune -o \
-type f 2>&1)
for FILE in "${LIST_FILES[@]}"; do
if IsValidShellScript "${FILE}"; then
debug "Adding ${FILE} to shell script files list"
FILE_ARRAY_BASH+=("${FILE}")
fi
done
###########################
# Set IFS back to default #
###########################
IFS="${DEFAULT_IFS}"
}

View file

@ -191,7 +191,6 @@ GITHUB_RUN_ID="${GITHUB_RUN_ID}" # GitHub RU
GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit
GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment GITHUB_TOKEN="${GITHUB_TOKEN}" # GitHub Token passed from environment
GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace
KUBERNETES_DIRECTORY="${KUBERNETES_DIRECTORY}" # Kubernetes directory
MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran MULTI_STATUS="${MULTI_STATUS:-true}" # Multiple status are created for each check ran
TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases
VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files
@ -203,7 +202,6 @@ DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate
DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally
DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_RUN_LOCAL='false' # Default value for debugging locally
DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases
DEFAULT_IFS="${IFS}" # Get the Default IFS for updating
############################################################### ###############################################################
# Default Vars that are called in Subs and need to be ignored # # Default Vars that are called in Subs and need to be ignored #
@ -229,52 +227,11 @@ OUTPUT_DETAILS="${OUTPUT_DETAILS:-simpler}" # What level of deta
########################## ##########################
# Array of changed files # # Array of changed files #
########################## ##########################
FILE_ARRAY_ARM=() # Array of files to check for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
FILE_ARRAY_BASH=() # Array of files to check FILE_ARRAY_VARIABLE_NAME="FILE_ARRAY_${LANGUAGE}"
FILE_ARRAY_CLOUDFORMATION=() # Array of files to check debug "Setting ${FILE_ARRAY_VARIABLE_NAME} variable..."
FILE_ARRAY_CLOJURE=() # Array of files to check eval "${FILE_ARRAY_VARIABLE_NAME}=()"
FILE_ARRAY_COFFEESCRIPT=() # Array of files to check done
FILE_ARRAY_CSHARP=() # Array of files to check
FILE_ARRAY_CSS=() # Array of files to check
FILE_ARRAY_DART=() # Array of files to check
FILE_ARRAY_DOCKERFILE=() # Array of files to check
FILE_ARRAY_ENV=() # Array of files to check
FILE_ARRAY_GO=() # Array of files to check
FILE_ARRAY_GROOVY=() # Array of files to check
FILE_ARRAY_HTML=() # Array of files to check
FILE_ARRAY_JAVA=() # Array of files to check
FILE_ARRAY_JAVASCRIPT_ES=() # Array of files to check
FILE_ARRAY_JAVASCRIPT_STANDARD=() # Array of files to check
FILE_ARRAY_JSON=() # Array of files to check
FILE_ARRAY_JSX=() # Array of files to check
FILE_ARRAY_KUBERNETES=()
FILE_ARRAY_KOTLIN=() # Array of files to check
FILE_ARRAY_LATEX=() # Array of files to check
FILE_ARRAY_LUA=() # Array of files to check
FILE_ARRAY_MARKDOWN=() # Array of files to check
FILE_ARRAY_OPENAPI=() # Array of files to check
FILE_ARRAY_PERL=() # Array of files to check
FILE_ARRAY_PHP_BUILTIN=() # Array of files to check
FILE_ARRAY_PHP_PHPCS=() # Array of files to check
FILE_ARRAY_PHP_PHPSTAN=() # Array of files to check
FILE_ARRAY_PHP_PSALM=() # Array of files to check
FILE_ARRAY_POWERSHELL=() # Array of files to check
FILE_ARRAY_PROTOBUF=() # Array of files to check
FILE_ARRAY_PYTHON_BLACK=() # Array of files to check
FILE_ARRAY_PYTHON_PYLINT=() # Array of files to check
FILE_ARRAY_PYTHON_FLAKE8=() # Array of files to check
FILE_ARRAY_R=() # Array of files to check
FILE_ARRAY_RAKU=() # Array of files to check
FILE_ARRAY_RUBY=() # Array of files to check
FILE_ARRAY_SNAKEMAKE=() # 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
FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check
FILE_ARRAY_XML=() # Array of files to check
FILE_ARRAY_YAML=() # Array of files to check
################################################################################ ################################################################################
########################## FUNCTIONS BELOW ##################################### ########################## FUNCTIONS BELOW #####################################
@ -354,6 +311,14 @@ GetLinterRules() {
LANGUAGE_LINTER_RULES="${LANGUAGE_NAME}_LINTER_RULES" LANGUAGE_LINTER_RULES="${LANGUAGE_NAME}_LINTER_RULES"
debug "Variable names for language file name: ${LANGUAGE_FILE_NAME}, language linter rules: ${LANGUAGE_LINTER_RULES}" debug "Variable names for language file name: ${LANGUAGE_FILE_NAME}, language linter rules: ${LANGUAGE_LINTER_RULES}"
#####################################################
# Check if the language rules variables are defined #
#####################################################
if [ -z "${!LANGUAGE_FILE_NAME+x}" ]; then
debug "${LANGUAGE_FILE_NAME} is not set. Skipping loading rules for ${LANGUAGE_NAME}..."
return
fi
########################## ##########################
# Get the file extension # # Get the file extension #
########################## ##########################
@ -615,7 +580,7 @@ DetectAWSStatesFIle() {
############################### ###############################
# check if file has resources # # check if file has resources #
############################### ###############################
if grep '"Resource": *"arn"*' "${FILE}"; then if grep -q '"Resource": *"arn"*' "${FILE}"; then
# Found it # Found it
return 0 return 0
fi fi
@ -1091,8 +1056,6 @@ GetGitHubVars
######################################################## ########################################################
DEFAULT_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/ansible" # Default Ansible Directory DEFAULT_ANSIBLE_DIRECTORY="${GITHUB_WORKSPACE}/ansible" # Default Ansible Directory
export DEFAULT_ANSIBLE_DIRECTORY # Workaround SC2034 export DEFAULT_ANSIBLE_DIRECTORY # Workaround SC2034
DEFAULT_KUBERNETES_DIRECTORY="${GITHUB_WORKSPACE}/kubernetes" # Default Kubernetes Directory
export DEFAULT_KUBERNETES_DIRECTORY # Workaround SC2034
REPORT_OUTPUT_FOLDER="${GITHUB_WORKSPACE}/${OUTPUT_FOLDER}" # Location for the report folder REPORT_OUTPUT_FOLDER="${GITHUB_WORKSPACE}/${OUTPUT_FOLDER}" # Location for the report folder
######################################### #########################################
@ -1103,70 +1066,10 @@ GetValidationInfo
######################## ########################
# Get the linter rules # # Get the linter rules #
######################## ########################
# Get Ansible rules for LANGUAGE in "${LANGUAGE_ARRAY[@]}"; do
GetLinterRules "ANSIBLE" debug "Loading rules for ${LANGUAGE}..."
# Get ARM rules eval "GetLinterRules ${LANGUAGE}"
GetLinterRules "ARM" done
# Get CLOUDFORMATION rules
GetLinterRules "CLOUDFORMATION"
# Get Coffeescript rules
GetLinterRules "COFFEESCRIPT"
# Get CSS rules
GetLinterRules "CSS"
# Get DART rules
GetLinterRules "DART"
# Get Docker rules
GetLinterRules "DOCKERFILE"
# Get Docker rules
GetLinterRules "DOCKERFILE_HADOLINT"
# Get Golang rules
GetLinterRules "GO"
# Get Groovy rules
GetLinterRules "GROOVY"
# Get HTML rules
GetLinterRules "HTML"
# get Java rules
GetLinterRules "JAVA"
# Get JavaScript rules
GetLinterRules "JAVASCRIPT"
# Get LATEX rules
GetLinterRules "LATEX"
# Get LUA rules
GetLinterRules "LUA"
# Get Markdown rules
GetLinterRules "MARKDOWN"
# Get PHPCS rules
GetLinterRules "PHP_PHPCS"
# Get PHP_PHPSTAN rules
GetLinterRules "PHP_PHPSTAN"
# Get PHP_PSALM rules
GetLinterRules "PHP_PSALM"
# Get PowerShell rules
GetLinterRules "POWERSHELL"
# Get Protobuff linter rules
GetLinterRules "PROTOBUF"
# Get Python pylint rules
GetLinterRules "PYTHON_PYLINT"
# Get Python flake8 rules
GetLinterRules "PYTHON_FLAKE8"
# Get Python black rules
GetLinterRules "PYTHON_BLACK"
# Get R rules
GetLinterRules "R"
# Get Ruby rules
GetLinterRules "RUBY"
# Get Snakemake lint rules
GetLinterRules "SNAKEMAKE_LINT"
# Get Snakemake snakefmt rules
GetLinterRules "SNAKEMAKE_SNAKEFMT"
# Get SQL rules
GetLinterRules "SQL"
# Get Terraform rules
GetLinterRules "TERRAFORM"
# Get TypeScript rules
GetLinterRules "TYPESCRIPT"
# Get YAML rules
GetLinterRules "YAML"
################################## ##################################
# Get and print all version info # # Get and print all version info #
@ -1190,15 +1093,10 @@ if [[ ${TEST_CASE_RUN} != "false" ]]; then
RunTestCases RunTestCases
fi fi
############################################# ###########################################
# check flag for validation of all codebase # # Build the list of files for each linter #
############################################# ###########################################
if [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then BuildFileList "${VALIDATE_ALL_CODEBASE}"
########################################
# Get list of files changed if env set #
########################################
BuildFileList
fi
################### ###################
# ANSIBLE LINTING # # ANSIBLE LINTING #
@ -1217,31 +1115,10 @@ fi
# ARM Template LINTING # # ARM Template LINTING #
######################## ########################
if [ "${VALIDATE_ARM}" == "true" ]; then if [ "${VALIDATE_ARM}" == "true" ]; then
# If we are validating all codebase we need to build file list because not every json file is an ARM file
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(json\)\$" 2>&1)
for FILE in "${LIST_FILES[@]}"; do
if DetectARMFile "${FILE}"; then
FILE_ARRAY_ARM+=("${FILE}")
fi
done
###########################
# Set IFS back to default #
###########################
IFS="${DEFAULT_IFS}"
fi
############################### ###############################
# Lint the ARM Template files # # Lint the ARM Template files #
############################### ###############################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_ARM[@]}"
LintCodebase "ARM" "arm-ttk" "Import-Module ${ARM_TTK_PSD1} ; \${config} = \$(Import-PowerShellDataFile -Path ${ARM_LINTER_RULES}) ; Test-AzTemplate @config -TemplatePath" "disabledfileext" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_ARM[@]}"
fi fi
################ ################
@ -1251,8 +1128,7 @@ if [ "${VALIDATE_BASH}" == "true" ]; then
####################### #######################
# Lint the bash files # # Lint the bash files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "BASH" "shellcheck" "shellcheck --color --external-sources" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_BASH[@]}"
LintCodebase "BASH" "shellcheck" "shellcheck --color --external-sources" "disabledfileext" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_BASH[@]}"
fi fi
##################### #####################
@ -1262,39 +1138,17 @@ if [ "${VALIDATE_BASH_EXEC}" == "true" ]; then
####################### #######################
# Lint the bash files # # Lint the bash files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "BASH_EXEC" "bash-exec" "bash-exec" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_BASH[@]}"
LintCodebase "BASH_EXEC" "bash-exec" "bash-exec" "disabledfileext" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_BASH[@]}"
fi fi
########################## ##########################
# CLOUDFORMATION LINTING # # CLOUDFORMATION LINTING #
########################## ##########################
if [ "${VALIDATE_CLOUDFORMATION}" == "true" ]; then if [ "${VALIDATE_CLOUDFORMATION}" == "true" ]; then
# If we are validating all codebase we need to build file list because not every yml/json file is an CLOUDFORMATION file
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
for FILE in "${LIST_FILES[@]}"; do
if DetectCloudFormationFile "${FILE}"; then
FILE_ARRAY_CLOUDFORMATION+=("${FILE}")
fi
done
###########################
# Set IFS back to default #
###########################
IFS="${DEFAULT_IFS}"
fi
################################# #################################
# Lint the CloudFormation files # # Lint the CloudFormation files #
################################# #################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "CLOUDFORMATION" "cfn-lint" "cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CLOUDFORMATION[@]}"
LintCodebase "CLOUDFORMATION" "cfn-lint" "cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}" "disabledfileext" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CLOUDFORMATION[@]}"
fi fi
################### ###################
@ -1308,7 +1162,7 @@ if [ "${VALIDATE_CLOJURE}" == "true" ]; then
######################### #########################
# Lint the Clojure files # # Lint the Clojure files #
######################### #########################
LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config ${CLOJURE_LINTER_RULES} --lint" ".*\.\(clj\|cljs\|cljc\|edn\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CLOJURE[@]}" LintCodebase "CLOJURE" "clj-kondo" "clj-kondo --config ${CLOJURE_LINTER_RULES} --lint" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CLOJURE[@]}"
fi fi
######################## ########################
@ -1318,8 +1172,7 @@ if [ "${VALIDATE_COFFEE}" == "true" ]; then
######################### #########################
# Lint the coffee files # # Lint the coffee files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_COFFEESCRIPT[@]}"
LintCodebase "COFFEESCRIPT" "coffeelint" "coffeelint -f ${COFFEESCRIPT_LINTER_RULES}" ".*\.\(coffee\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_COFFEESCRIPT[@]}"
fi fi
################## ##################
@ -1329,8 +1182,7 @@ if [ "${VALIDATE_CSHARP}" == "true" ]; then
######################### #########################
# Lint the C# files # # Lint the C# files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "CSHARP" "dotnet-format" "dotnet-format --folder --check --exclude / --include" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CSHARP[@]}"
LintCodebase "CSHARP" "dotnet-format" "dotnet-format --folder --check --exclude / --include" ".*\.\(cs\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CSHARP[@]}"
fi fi
############### ###############
@ -1344,7 +1196,7 @@ if [ "${VALIDATE_CSS}" == "true" ]; then
############################# #############################
# Lint the CSS files # # Lint the CSS files #
############################# #############################
LintCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" ".*\.\(css\|scss\|sass\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CSS[@]}" LintCodebase "CSS" "stylelint" "stylelint --config ${CSS_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_CSS[@]}"
fi fi
################ ################
@ -1354,8 +1206,7 @@ if [ "${VALIDATE_DART}" == "true" ]; then
####################### #######################
# Lint the Dart files # # Lint the Dart files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "DART" "dart" "dartanalyzer --fatal-infos --fatal-warnings --options ${DART_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_DART[@]}"
LintCodebase "DART" "dart" "dartanalyzer --fatal-infos --fatal-warnings --options ${DART_LINTER_RULES}" ".*\.\(dart\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_DART[@]}"
fi fi
################## ##################
@ -1365,9 +1216,8 @@ if [ "${VALIDATE_DOCKERFILE}" == "true" ]; then
######################### #########################
# Lint the docker files # # Lint the docker files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY"
# NOTE: dockerfilelint's "-c" option expects the folder *containing* the DOCKER_LINTER_RULES file # NOTE: dockerfilelint's "-c" option expects the folder *containing* the DOCKER_LINTER_RULES file
LintCodebase "DOCKERFILE" "dockerfilelint" "dockerfilelint -c $(dirname ${DOCKERFILE_LINTER_RULES})" ".*\(Dockerfile\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_DOCKERFILE[@]}" LintCodebase "DOCKERFILE" "dockerfilelint" "dockerfilelint -c $(dirname ${DOCKERFILE_LINTER_RULES})" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_DOCKERFILE[@]}"
fi fi
########################### ###########################
@ -1377,8 +1227,7 @@ if [ "${VALIDATE_DOCKERFILE_HADOLINT}" == "true" ]; then
######################### #########################
# Lint the docker files # # Lint the docker files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "DOCKERFILE_HADOLINT" "hadolint" "hadolint -c ${DOCKERFILE_HADOLINT_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_DOCKERFILE_HADOLINT[@]}"
LintCodebase "DOCKERFILE_HADOLINT" "hadolint" "hadolint -c ${DOCKERFILE_HADOLINT_LINTER_RULES}" ".*\(Dockerfile\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_DOCKERFILE[@]}"
fi fi
######################## ########################
@ -1388,8 +1237,7 @@ if [ "${VALIDATE_EDITORCONFIG}" == "true" ]; then
#################################### ####################################
# Lint the files with editorconfig # # Lint the files with editorconfig #
#################################### ####################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "EDITORCONFIG" "editorconfig-checker" "editorconfig-checker" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_EDITORCONFIG[@]}"
LintCodebase "EDITORCONFIG" "editorconfig-checker" "editorconfig-checker" "^.*$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${RAW_FILE_ARRAY[@]}"
fi fi
############### ###############
@ -1399,8 +1247,7 @@ if [ "${VALIDATE_ENV}" == "true" ]; then
####################### #######################
# Lint the env files # # Lint the env files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "ENV" "dotenv-linter" "dotenv-linter" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_ENV[@]}"
LintCodebase "ENV" "dotenv-linter" "dotenv-linter" ".*\.\(env\).*\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_ENV[@]}"
fi fi
################## ##################
@ -1410,8 +1257,7 @@ if [ "${VALIDATE_GO}" == "true" ]; then
######################### #########################
# Lint the golang files # # Lint the golang files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "GO" "golangci-lint" "golangci-lint run -c ${GO_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_GO[@]}"
LintCodebase "GO" "golangci-lint" "golangci-lint run -c ${GO_LINTER_RULES}" ".*\.\(go\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_GO[@]}"
fi fi
################## ##################
@ -1421,8 +1267,7 @@ if [ "$VALIDATE_GROOVY" == "true" ]; then
######################### #########################
# Lint the groovy files # # Lint the groovy files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "GROOVY" "npm-groovy-lint" "npm-groovy-lint -c $GROOVY_LINTER_RULES --failon warning" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_GROOVY[@]}"
LintCodebase "GROOVY" "npm-groovy-lint" "npm-groovy-lint -c $GROOVY_LINTER_RULES --failon warning" ".*\.\(groovy\|jenkinsfile\|gradle\|nf\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_GROOVY[@]}"
fi fi
################ ################
@ -1436,7 +1281,7 @@ if [ "${VALIDATE_HTML}" == "true" ]; then
####################### #######################
# Lint the HTML files # # Lint the HTML files #
####################### #######################
LintCodebase "HTML" "htmlhint" "htmlhint --config ${HTML_LINTER_RULES}" ".*\.\(html\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_HTML[@]}" LintCodebase "HTML" "htmlhint" "htmlhint --config ${HTML_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_HTML[@]}"
fi fi
################ ################
@ -1446,8 +1291,7 @@ if [ "$VALIDATE_JAVA" == "true" ]; then
####################### #######################
# Lint the JAVA files # # Lint the JAVA files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "JAVA" "checkstyle" "java -jar /usr/bin/checkstyle -c ${JAVA_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JAVA[@]}"
LintCodebase "JAVA" "checkstyle" "java -jar /usr/bin/checkstyle -c ${JAVA_LINTER_RULES}" ".*\.\(java\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JAVA[@]}"
fi fi
###################### ######################
@ -1457,8 +1301,7 @@ if [ "${VALIDATE_JAVASCRIPT_ES}" == "true" ]; then
############################# #############################
# Lint the Javascript files # # Lint the Javascript files #
############################# #############################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "JAVASCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${JAVASCRIPT_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JAVASCRIPT_ES[@]}"
LintCodebase "JAVASCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${JAVASCRIPT_LINTER_RULES}" ".*\.\(js\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JAVASCRIPT_ES[@]}"
fi fi
###################### ######################
@ -1472,8 +1315,7 @@ if [ "${VALIDATE_JAVASCRIPT_STANDARD}" == "true" ]; then
############################# #############################
# Lint the Javascript files # # Lint the Javascript files #
############################# #############################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "JAVASCRIPT_STANDARD" "standard" "standard ${JAVASCRIPT_STANDARD_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JAVASCRIPT_STANDARD[@]}"
LintCodebase "JAVASCRIPT_STANDARD" "standard" "standard ${JAVASCRIPT_STANDARD_LINTER_RULES}" ".*\.\(js\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JAVASCRIPT_STANDARD[@]}"
fi fi
################ ################
@ -1483,8 +1325,7 @@ if [ "${VALIDATE_JSON}" == "true" ]; then
####################### #######################
# Lint the json files # # Lint the json files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "JSON" "jsonlint" "jsonlint" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JSON[@]}"
LintCodebase "JSON" "jsonlint" "jsonlint" ".*\.\(json\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JSON[@]}"
fi fi
############### ###############
@ -1494,50 +1335,24 @@ if [ "${VALIDATE_JSX}" == "true" ]; then
###################### ######################
# Lint the JSX files # # Lint the JSX files #
###################### ######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "JSX" "eslint" "eslint --no-eslintrc -c ${JAVASCRIPT_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JSX[@]}"
LintCodebase "JSX" "eslint" "eslint --no-eslintrc -c ${JAVASCRIPT_LINTER_RULES}" ".*\.\(jsx\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_JSX[@]}"
fi fi
################## ##################
# KOTLIN LINTING # # KOTLIN LINTING #
################## ##################
if [ "${VALIDATE_KOTLIN}" == "true" ]; then if [ "${VALIDATE_KOTLIN}" == "true" ]; then
####################### #########################
# Lint the Kotlin files # # Lint the Kotlin files #
####################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "KOTLIN" "ktlint" "ktlint" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_KOTLIN[@]}"
LintCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_KOTLIN[@]}"
fi fi
############################## ##############################
# KUBERNETES Kubeval LINTING # # KUBERNETES Kubeval LINTING #
############################## ##############################
if [ "${VALIDATE_KUBERNETES_KUBEVAL}" == "true" ]; then if [ "${VALIDATE_KUBERNETES_KUBEVAL}" == "true" ]; then
if [ -d "${KUBERNETES_DIRECTORY}" ]; then LintCodebase "KUBERNETES_KUBEVAL" "kubeval" "kubeval --strict" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_KUBERNETES_KUBEVAL[@]}"
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
mapfile -t LIST_FILES < <(find "${KUBERNETES_DIRECTORY}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
for FILE in "${LIST_FILES[@]}"; do
if DetectKubernetesFile "${FILE}"; then
FILE_ARRAY_KUBERNETES+=("${FILE}")
fi
done
###########################
# Set IFS back to default #
###########################
IFS="${DEFAULT_IFS}"
fi
LintCodebase "KUBERNETES_KUBEVAL" "kubeval" "kubeval --strict" ".*\.\(yml\|yaml\|json\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_KUBERNETES[@]}"
else
warn "No Kubernetes directory found at:[${KUBERNETES_DIRECTORY}]"
debug "skipping Kubeval lint"
fi
fi fi
################# #################
@ -1547,8 +1362,7 @@ if [ "${VALIDATE_LATEX}" == "true" ]; then
######################## ########################
# Lint the LATEX files # # Lint the LATEX files #
######################## ########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "LATEX" "chktex" "chktex -q -l ${LATEX_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_LATEX[@]}"
LintCodebase "LATEX" "chktex" "chktex -q -l ${LATEX_LINTER_RULES}" ".*\.\(tex\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_LATEX[@]}"
fi fi
############### ###############
@ -1558,8 +1372,7 @@ if [ "${VALIDATE_LUA}" == "true" ]; then
###################### ######################
# Lint the Lua files # # Lint the Lua files #
###################### ######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "LUA" "lua" "luacheck --config ${LUA_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_LUA[@]}"
LintCodebase "LUA" "lua" "luacheck --config ${LUA_LINTER_RULES}" ".*\.\(lua\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_LUA[@]}"
fi fi
#################### ####################
@ -1569,39 +1382,17 @@ if [ "${VALIDATE_MARKDOWN}" == "true" ]; then
########################### ###########################
# Lint the Markdown Files # # Lint the Markdown Files #
########################### ###########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "MARKDOWN" "markdownlint" "markdownlint -c ${MARKDOWN_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_MARKDOWN[@]}"
LintCodebase "MARKDOWN" "markdownlint" "markdownlint -c ${MARKDOWN_LINTER_RULES}" ".*\.\(md\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_MARKDOWN[@]}"
fi fi
################### ###################
# OPENAPI LINTING # # OPENAPI LINTING #
################### ###################
if [ "${VALIDATE_OPENAPI}" == "true" ]; then if [ "${VALIDATE_OPENAPI}" == "true" ]; then
# If we are validating all codebase we need to build file list because not every yml/json file is an OpenAPI file
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(yml\|yaml\|json\)\$" 2>&1)
for FILE in "${LIST_FILES[@]}"; do
if DetectOpenAPIFile "${FILE}"; then
FILE_ARRAY_OPENAPI+=("${FILE}")
fi
done
###########################
# Set IFS back to default #
###########################
IFS="${DEFAULT_IFS}"
fi
########################## ##########################
# Lint the OpenAPI files # # Lint the OpenAPI files #
########################## ##########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "OPENAPI" "spectral" "spectral lint -r ${OPENAPI_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_OPENAPI[@]}"
LintCodebase "OPENAPI" "spectral" "spectral lint -r ${OPENAPI_LINTER_RULES}" "disabledfileext" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_OPENAPI[@]}"
fi fi
################ ################
@ -1611,8 +1402,7 @@ if [ "${VALIDATE_PERL}" == "true" ]; then
####################### #######################
# Lint the perl files # # Lint the perl files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PERL" "perl" "perlcritic" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PERL[@]}"
LintCodebase "PERL" "perl" "perlcritic" ".*\.\(pl\|pm\|t\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PERL[@]}"
fi fi
################ ################
@ -1622,32 +1412,28 @@ if [ "${VALIDATE_PHP_BUILTIN}" == "true" ]; then
################################################ ################################################
# Lint the PHP files using built-in PHP linter # # Lint the PHP files using built-in PHP linter #
################################################ ################################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PHP_BUILTIN" "php" "php -l" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_BUILTIN[@]}"
LintCodebase "PHP_BUILTIN" "php" "php -l" ".*\.\(php\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_BUILTIN[@]}"
fi fi
if [ "${VALIDATE_PHP_PHPCS}" == "true" ]; then if [ "${VALIDATE_PHP_PHPCS}" == "true" ]; then
############################################ ############################################
# Lint the PHP files using PHP CodeSniffer # # Lint the PHP files using PHP CodeSniffer #
############################################ ############################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PHP_PHPCS" "phpcs" "phpcs --standard=${PHP_PHPCS_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_PHPCS[@]}"
LintCodebase "PHP_PHPCS" "phpcs" "phpcs --standard=${PHP_PHPCS_LINTER_RULES}" ".*\.\(php\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_PHPCS[@]}"
fi fi
if [ "${VALIDATE_PHP_PHPSTAN}" == "true" ]; then if [ "${VALIDATE_PHP_PHPSTAN}" == "true" ]; then
####################### #######################
# Lint the PHP files using PHPStan # # Lint the PHP files using PHPStan #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PHP_PHPSTAN" "phpstan" "phpstan analyse --no-progress --no-ansi -c ${PHP_PHPSTAN_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_PHPSTAN[@]}"
LintCodebase "PHP_PHPSTAN" "phpstan" "phpstan analyse --no-progress --no-ansi -c ${PHP_PHPSTAN_LINTER_RULES}" ".*\.\(php\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_PHPSTAN[@]}"
fi fi
if [ "${VALIDATE_PHP_PSALM}" == "true" ]; then if [ "${VALIDATE_PHP_PSALM}" == "true" ]; then
################################## ##################################
# Lint the PHP files using Psalm # # Lint the PHP files using Psalm #
################################## ##################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PHP_PSALM" "psalm" "psalm --config=${PHP_PSALM_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_PSALM[@]}"
LintCodebase "PHP_PSALM" "psalm" "psalm --config=${PHP_PSALM_LINTER_RULES}" ".*\.\(php\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PHP_PSALM[@]}"
fi fi
###################### ######################
@ -1662,8 +1448,7 @@ if [ "${VALIDATE_POWERSHELL}" == "true" ]; then
############################# #############################
# Lint the powershell files # # Lint the powershell files #
############################# #############################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "POWERSHELL" "pwsh" "Invoke-ScriptAnalyzer -EnableExit -Settings ${POWERSHELL_LINTER_RULES} -Path" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_POWERSHELL[@]}"
LintCodebase "POWERSHELL" "pwsh" "Invoke-ScriptAnalyzer -EnableExit -Settings ${POWERSHELL_LINTER_RULES} -Path" ".*\.\(ps1\|psm1\|psd1\|ps1xml\|pssc\|psrc\|cdxml\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_POWERSHELL[@]}"
fi fi
#################### ####################
@ -1673,8 +1458,7 @@ if [ "${VALIDATE_PROTOBUF}" == "true" ]; then
####################### #######################
# Lint the Protocol Buffers files # # Lint the Protocol Buffers files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PROTOBUF" "protolint" "protolint lint --config_path ${PROTOBUF_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PROTOBUF[@]}"
LintCodebase "PROTOBUF" "protolint" "protolint lint --config_path ${PROTOBUF_LINTER_RULES}" ".*\.\(proto\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PROTOBUF[@]}"
fi fi
######################## ########################
@ -1684,8 +1468,7 @@ if [ "${VALIDATE_PYTHON_BLACK}" == "true" ]; then
######################### #########################
# Lint the python files # # Lint the python files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PYTHON_BLACK" "black" "black --config ${PYTHON_BLACK_LINTER_RULES} --diff --check" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PYTHON_BLACK[@]}"
LintCodebase "PYTHON_BLACK" "black" "black --config ${PYTHON_BLACK_LINTER_RULES} --diff --check" ".*\.\(py\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PYTHON_BLACK[@]}"
fi fi
######################### #########################
@ -1695,8 +1478,7 @@ if [ "${VALIDATE_PYTHON_PYLINT}" == "true" ]; then
######################### #########################
# Lint the python files # # Lint the python files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PYTHON_PYLINT" "pylint" "pylint --rcfile ${PYTHON_PYLINT_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PYTHON_PYLINT[@]}"
LintCodebase "PYTHON_PYLINT" "pylint" "pylint --rcfile ${PYTHON_PYLINT_LINTER_RULES}" ".*\.\(py\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PYTHON_PYLINT[@]}"
fi fi
######################### #########################
@ -1706,8 +1488,7 @@ if [ "${VALIDATE_PYTHON_FLAKE8}" == "true" ]; then
######################### #########################
# Lint the python files # # Lint the python files #
######################### #########################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "PYTHON_FLAKE8" "flake8" "flake8 --config=${PYTHON_FLAKE8_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PYTHON_FLAKE8[@]}"
LintCodebase "PYTHON_FLAKE8" "flake8" "flake8 --config=${PYTHON_FLAKE8_LINTER_RULES}" ".*\.\(py\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_PYTHON_FLAKE8[@]}"
fi fi
############# #############
@ -1717,6 +1498,7 @@ if [ "${VALIDATE_R}" == "true" ]; then
########################## ##########################
# Check for local config # # Check for local config #
########################## ##########################
# shellcheck disable=SC2153
if [ ! -f "${GITHUB_WORKSPACE}/.lintr" ] && ((${#FILE_ARRAY_R[@]})); then if [ ! -f "${GITHUB_WORKSPACE}/.lintr" ] && ((${#FILE_ARRAY_R[@]})); then
info "No .lintr configuration file found, using defaults." info "No .lintr configuration file found, using defaults."
cp $R_LINTER_RULES "$GITHUB_WORKSPACE" cp $R_LINTER_RULES "$GITHUB_WORKSPACE"
@ -1725,7 +1507,7 @@ if [ "${VALIDATE_R}" == "true" ]; then
###################### ######################
# Lint the R files # # Lint the R files #
###################### ######################
LintCodebase "R" "lintr" "lintr::lint(File)" ".*\.\(r\|R\|Rmd\|rmd\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_R[@]}" LintCodebase "R" "lintr" "lintr::lint(File)" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_R[@]}"
fi fi
################ ################
@ -1738,8 +1520,7 @@ if [ "${VALIDATE_RAKU}" == "true" ]; then
if [ -e "${GITHUB_WORKSPACE}/META6.json" ]; then if [ -e "${GITHUB_WORKSPACE}/META6.json" ]; then
cd "${GITHUB_WORKSPACE}" && zef install --deps-only --/test . cd "${GITHUB_WORKSPACE}" && zef install --deps-only --/test .
fi fi
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "RAKU" "raku" "raku -I ${GITHUB_WORKSPACE}/lib -c" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_RAKU[@]}"
LintCodebase "RAKU" "raku" "raku -I ${GITHUB_WORKSPACE}/lib -c" ".*\.\(raku\|rakumod\|rakutest\|pm6\|pl6\|p6\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_RAKU[@]}"
fi fi
################ ################
@ -1749,8 +1530,7 @@ if [ "${VALIDATE_RUBY}" == "true" ]; then
####################### #######################
# Lint the ruby files # # Lint the ruby files #
####################### #######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES} --force-exclusion" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_RUBY[@]}"
LintCodebase "RUBY" "rubocop" "rubocop -c ${RUBY_LINTER_RULES} --force-exclusion" ".*\.\(rb\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_RUBY[@]}"
fi fi
################# #################
@ -1762,8 +1542,7 @@ if [ "${VALIDATE_SHELL_SHFMT}" == "true" ]; then
#################################### ####################################
EDITORCONFIG_FILE_PATH="${GITHUB_WORKSPACE}"/.editorconfig EDITORCONFIG_FILE_PATH="${GITHUB_WORKSPACE}"/.editorconfig
if [ -e "$EDITORCONFIG_FILE_PATH" ]; then if [ -e "$EDITORCONFIG_FILE_PATH" ]; then
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "SHELL_SHFMT" "shfmt" "shfmt -d" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_SHELL_SHFMT[@]}"
LintCodebase "SHELL_SHFMT" "shfmt" "shfmt -d" ".*\.\(sh\|bash\|dash\|ksh\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_BASH[@]}"
else else
############################### ###############################
# No .editorconfig file found # # No .editorconfig file found #
@ -1777,53 +1556,24 @@ fi
# SNAKEMAKE LINT # # SNAKEMAKE LINT #
################## ##################
if [ "${VALIDATE_SNAKEMAKE_LINT}" == "true" ]; then if [ "${VALIDATE_SNAKEMAKE_LINT}" == "true" ]; then
################################ LintCodebase "SNAKEMAKE_LINT" "snakemake" "snakemake --lint -s" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_SNAKEMAKE_LINT[@]}"
# Lint the files with snakefmt #
################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY"
LintCodebase "SNAKEMAKE_LINT" "snakemake" "snakemake --lint -s" ".*\(Snakefile\|\.smk\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_SNAKEMAKE[@]}"
fi fi
###################### ######################
# SNAKEMAKE SNAKEFMT # # SNAKEMAKE SNAKEFMT #
###################### ######################
if [ "${VALIDATE_SNAKEMAKE_SNAKEFMT}" == "true" ]; then if [ "${VALIDATE_SNAKEMAKE_SNAKEFMT}" == "true" ]; then
################################ LintCodebase "SNAKEMAKE_SNAKEFMT" "snakefmt" "snakefmt --config ${SNAKEMAKE_SNAKEFMT_LINTER_RULES} --check --compact-diff" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_SNAKEMAKE_SNAKEFMT[@]}"
# Lint the files with snakefmt #
################################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY"
LintCodebase "SNAKEMAKE_SNAKEFMT" "snakefmt" "snakefmt --config ${SNAKEMAKE_SNAKEFMT_LINTER_RULES} --check --compact-diff" ".*\(Snakefile\|\.smk\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_SNAKEMAKE[@]}"
fi fi
###################### ######################
# AWS STATES LINTING # # AWS STATES LINTING #
###################### ######################
if [ "${VALIDATE_STATES}" == "true" ]; then if [ "${VALIDATE_STATES}" == "true" ]; then
# If we are validating all codebase we need to build file list because not every json file is an aws states file
if [ "${VALIDATE_ALL_CODEBASE}" == "true" ]; then
###############################################################################
# Set the file seperator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" -path "*/node_modules" -prune -o -type f -regex ".*\.\(json\)\$" 2>&1)
for FILE in "${LIST_FILES[@]}"; do
if DetectAWSStatesFIle "${FILE}"; then
FILE_ARRAY_STATES+=("${FILE}")
fi
done
###########################
# Set IFS back to default #
###########################
IFS="${DEFAULT_IFS}"
fi
######################### #########################
# Lint the STATES files # # Lint the STATES files #
######################### #########################
LintCodebase "STATES" "asl-validator" "asl-validator --json-path" "disabledfileext" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_STATES[@]}" LintCodebase "STATES" "asl-validator" "asl-validator --json-path" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_STATES[@]}"
fi fi
############### ###############
@ -1833,8 +1583,7 @@ if [ "${VALIDATE_SQL}" == "true" ]; then
###################### ######################
# Lint the SQL files # # Lint the SQL files #
###################### ######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "SQL" "sql-lint" "sql-lint --config ${SQL_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_SQL[@]}"
LintCodebase "SQL" "sql-lint" "sql-lint --config ${SQL_LINTER_RULES}" ".*\.\(sql\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_SQL[@]}"
fi fi
##################### #####################
@ -1844,8 +1593,7 @@ if [ "${VALIDATE_TERRAFORM}" == "true" ]; then
############################ ############################
# Lint the Terraform files # # Lint the Terraform files #
############################ ############################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "TERRAFORM" "tflint" "tflint -c ${TERRAFORM_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TERRAFORM[@]}"
LintCodebase "TERRAFORM" "tflint" "tflint -c ${TERRAFORM_LINTER_RULES}" ".*\.\(tf\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TERRAFORM[@]}"
fi fi
############################### ###############################
@ -1855,8 +1603,7 @@ if [ "${VALIDATE_TERRAFORM_TERRASCAN}" == "true" ]; then
############################ ############################
# Lint the Terraform files # # Lint the Terraform files #
############################ ############################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan scan -p /root/.terrascan/pkg/policies/opa/rego/ -t aws -f " "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TERRAFORM_TERRASCAN[@]}"
LintCodebase "TERRAFORM_TERRASCAN" "terrascan" "terrascan scan -p /root/.terrascan/pkg/policies/opa/rego/ -t aws -f " ".*\.\(tf\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TERRAFORM_TERRASCAN[@]}"
fi fi
############### ###############
@ -1866,7 +1613,7 @@ if [ "${VALIDATE_TSX}" == "true" ]; then
###################### ######################
# Lint the TSX files # # Lint the TSX files #
###################### ######################
LintCodebase "TSX" "eslint" "eslint --no-eslintrc -c ${TYPESCRIPT_LINTER_RULES}" ".*\.\(tsx\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TSX[@]}" LintCodebase "TSX" "eslint" "eslint --no-eslintrc -c ${TYPESCRIPT_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TSX[@]}"
fi fi
###################### ######################
@ -1876,7 +1623,7 @@ if [ "${VALIDATE_TYPESCRIPT_ES}" == "true" ]; then
############################# #############################
# Lint the Typescript files # # Lint the Typescript files #
############################# #############################
LintCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${TYPESCRIPT_LINTER_RULES}" ".*\.\(ts\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TYPESCRIPT_ES[@]}" LintCodebase "TYPESCRIPT_ES" "eslint" "eslint --no-eslintrc -c ${TYPESCRIPT_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TYPESCRIPT_ES[@]}"
fi fi
###################### ######################
@ -1890,7 +1637,7 @@ if [ "${VALIDATE_TYPESCRIPT_STANDARD}" == "true" ]; then
############################# #############################
# Lint the Typescript files # # Lint the Typescript files #
############################# #############################
LintCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin ${TYPESCRIPT_STANDARD_LINTER_RULES}" ".*\.\(ts\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TYPESCRIPT_STANDARD[@]}" LintCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin ${TYPESCRIPT_STANDARD_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_TYPESCRIPT_STANDARD[@]}"
fi fi
############### ###############
@ -1900,8 +1647,7 @@ if [ "${VALIDATE_XML}" == "true" ]; then
###################### ######################
# Lint the XML Files # # Lint the XML Files #
###################### ######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "XML" "xmllint" "xmllint" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_XML[@]}"
LintCodebase "XML" "xmllint" "xmllint" ".*\.\(xml\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_XML[@]}"
fi fi
################ ################
@ -1911,8 +1657,7 @@ if [ "${VALIDATE_YAML}" == "true" ]; then
###################### ######################
# Lint the Yml Files # # Lint the Yml Files #
###################### ######################
# LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILTER_REGEX_INCLUDE" "FILTER_REGEX_EXCLUDE" "FILE_ARRAY" LintCodebase "YAML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_YAML[@]}"
LintCodebase "YAML" "yamllint" "yamllint -c ${YAML_LINTER_RULES}" ".*\.\(yml\|yaml\)\$" "${FILTER_REGEX_INCLUDE}" "${FILTER_REGEX_EXCLUDE}" "${FILE_ARRAY_YAML[@]}"
fi fi
########### ###########

View file

@ -99,6 +99,7 @@ function GetValidationInfo() {
# No linter flags were set - default all to true # No linter flags were set - default all to true
eval "${VALIDATE_LANGUAGE}='true'" eval "${VALIDATE_LANGUAGE}='true'"
fi fi
eval "export ${VALIDATE_LANGUAGE}"
done done
####################################### #######################################
@ -145,26 +146,6 @@ function GetValidationInfo() {
debug "Setting Ansible directory to: ${ANSIBLE_DIRECTORY}" debug "Setting Ansible directory to: ${ANSIBLE_DIRECTORY}"
fi fi
#################################
# Validate Kubernetes Directory #
#################################
if [ -z "${KUBERNETES_DIRECTORY}" ]; then
# No Value, need to default
KUBERNETES_DIRECTORY="${DEFAULT_KUBERNETES_DIRECTORY}"
debug "Setting Kubernetes directory to the default: ${DEFAULT_KUBERNETES_DIRECTORY}"
else
# Check if first char is '/'
if [[ ${KUBERNETES_DIRECTORY:0:1} == "/" ]]; then
# Remove first char
KUBERNETES_DIRECTORY="${KUBERNETES_DIRECTORY:1}"
fi
# Need to give it full path
TEMP_KUBERNETES_DIRECTORY="${GITHUB_WORKSPACE}/${KUBERNETES_DIRECTORY}"
# Set the value
KUBERNETES_DIRECTORY="${TEMP_KUBERNETES_DIRECTORY}"
debug "Setting Kubernetes directory to: ${KUBERNETES_DIRECTORY}"
fi
############################### ###############################
# Get the disable errors flag # # Get the disable errors flag #
############################### ###############################

View file

@ -16,7 +16,6 @@ function LintCodebase() {
FILE_TYPE="${1}" && shift # Pull the variable and remove from array path (Example: JSON) FILE_TYPE="${1}" && shift # Pull the variable and remove from array path (Example: JSON)
LINTER_NAME="${1}" && shift # Pull the variable and remove from array path (Example: jsonlint) LINTER_NAME="${1}" && shift # Pull the variable and remove from array path (Example: jsonlint)
LINTER_COMMAND="${1}" && shift # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file) LINTER_COMMAND="${1}" && shift # Pull the variable and remove from array path (Example: jsonlint -c ConfigFile /path/to/file)
FILE_EXTENSIONS="${1}" && shift # Pull the variable and remove from array path (Example: *.json)
FILTER_REGEX_INCLUDE="${1}" && shift # Pull the variable and remove from array path (Example: */src/*,*/test/*) FILTER_REGEX_INCLUDE="${1}" && shift # Pull the variable and remove from array path (Example: */src/*,*/test/*)
FILTER_REGEX_EXCLUDE="${1}" && shift # Pull the variable and remove from array path (Example: */examples/*,*/test/*.test) FILTER_REGEX_EXCLUDE="${1}" && shift # Pull the variable and remove from array path (Example: */examples/*,*/test/*.test)
FILE_ARRAY=("$@") # Array of files to validate (Example: ${FILE_ARRAY_JSON}) FILE_ARRAY=("$@") # Array of files to validate (Example: ${FILE_ARRAY_JSON})
@ -75,54 +74,12 @@ function LintCodebase() {
############################################################ ############################################################
# Check to see if we need to go through array or all files # # Check to see if we need to go through array or all files #
############################################################ ############################################################
if [ ${#FILE_ARRAY[@]} -eq 0 ] && [ "${VALIDATE_ALL_CODEBASE}" == "false" ]; then if [ ${#FILE_ARRAY[@]} -eq 0 ]; then
# No files found in commit and user has asked to not validate code base
SKIP_FLAG=1 SKIP_FLAG=1
debug " - No files found in changeset to lint for language:[${FILE_TYPE}]" debug " - No files found in changeset to lint for language:[${FILE_TYPE}]"
elif [ ${#FILE_ARRAY[@]} -ne 0 ]; then else
# We have files added to array of files to check # We have files added to array of files to check
LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list LIST_FILES=("${FILE_ARRAY[@]}") # Copy the array into list
else
if [[ ${FILE_TYPE} == "BASH" ]] ||
[[ ${FILE_TYPE} == "BASH_EXEC" ]] ||
[[ ${FILE_TYPE} == "SHELL_SHFMT" ]]; then
# Populate a list of valid shell scripts.
PopulateShellScriptsList
else
###############################################################################
# Set the file separator to newline to allow for grabbing objects with spaces #
###############################################################################
IFS=$'\n'
#################################
# Get list of all files to lint #
#################################
mapfile -t LIST_FILES < <(find "${GITHUB_WORKSPACE}" \
-path "*/node_modules" -prune -o \
-path "*/.git" -prune -o \
-path "*/.venv" -prune -o \
-path "*/.rbenv" -prune -o \
-type f -regex "${FILE_EXTENSIONS}" 2>&1)
###########################
# Set IFS back to default #
###########################
IFS="${DEFAULT_IFS}"
fi
############################################################
# Set it back to empty if loaded with blanks from scanning #
############################################################
if [ ${#LIST_FILES[@]} -lt 1 ]; then
######################
# Set to empty array #
######################
LIST_FILES=()
#############################
# Skip as we found no files #
#############################
SKIP_FLAG=1
fi
fi fi
################################################# #################################################