From 31efa2eb68bd634ee181b3b09aba99e35fe2305a Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 18 Jun 2020 13:53:45 -0500 Subject: [PATCH 01/23] Changing from Admiralawkbar to github --- .github/workflows/deploy-DEV.yml | 6 +++--- .github/workflows/deploy-PROD.yml | 2 +- .github/workflows/stack-linter.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-DEV.yml b/.github/workflows/deploy-DEV.yml index 35760ab0..4b6975d7 100644 --- a/.github/workflows/deploy-DEV.yml +++ b/.github/workflows/deploy-DEV.yml @@ -48,7 +48,7 @@ jobs: # Set the Env Vars DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - IMAGE_REPO: admiralawkbar/super-linter + IMAGE_REPO: github/super-linter DOCKERFILE_PATH: Dockerfile shell: bash run: .automation/upload-docker.sh @@ -66,5 +66,5 @@ jobs: - name: Run Test Cases shell: bash run: | - docker pull admiralawkbar/super-linter:${BRANCH_NAME} - docker run -e RUN_LOCAL=true -e TEST_CASE_RUN=true -v ${GITHUB_WORKSPACE}:/tmp/lint admiralawkbar/super-linter:${BRANCH_NAME} + docker pull github/super-linter:${BRANCH_NAME} + docker run -e RUN_LOCAL=true -e TEST_CASE_RUN=true -v ${GITHUB_WORKSPACE}:/tmp/lint github/super-linter:${BRANCH_NAME} diff --git a/.github/workflows/deploy-PROD.yml b/.github/workflows/deploy-PROD.yml index ab853943..fd39563b 100644 --- a/.github/workflows/deploy-PROD.yml +++ b/.github/workflows/deploy-PROD.yml @@ -45,7 +45,7 @@ jobs: # Set the Env Vars DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - IMAGE_REPO: admiralawkbar/super-linter + IMAGE_REPO: github/super-linter IMAGE_VERSION: latest DOCKERFILE_PATH: Dockerfile shell: bash diff --git a/.github/workflows/stack-linter.yml b/.github/workflows/stack-linter.yml index c6d8c58a..cac0000a 100644 --- a/.github/workflows/stack-linter.yml +++ b/.github/workflows/stack-linter.yml @@ -41,6 +41,6 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: docker://admiralawkbar/super-linter:latest + uses: github/super-linter env: VALIDATE_ALL_CODEBASE: false From d5d29c2ac9dfa33a720397f66d44918c72decc7e Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 18 Jun 2020 14:02:54 -0500 Subject: [PATCH 02/23] more updates --- .automation/upload-docker.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index 36c8dd02..e6f42be1 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -5,6 +5,7 @@ ################################################################################ # NOTES: This script is used to upload a Dockerfile to DockerHub +# under the GitHub organization # Its based on being built from a GitHub Action, but could be easily updated # To be ran in a different medium. # From 3764738cee4f6a16e53e064f5a541ae6ad65e39a Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 18 Jun 2020 14:06:05 -0500 Subject: [PATCH 03/23] fixed version --- .github/workflows/stack-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stack-linter.yml b/.github/workflows/stack-linter.yml index cac0000a..dea3d9a3 100644 --- a/.github/workflows/stack-linter.yml +++ b/.github/workflows/stack-linter.yml @@ -41,6 +41,6 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: github/super-linter + uses: github/super-linter@v2.0.0 env: VALIDATE_ALL_CODEBASE: false From eb9f7498f852c6659e78fd92f8e2d14f8a62efc6 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 18 Jun 2020 14:09:33 -0500 Subject: [PATCH 04/23] using the built container and not the repo --- .github/workflows/stack-linter.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stack-linter.yml b/.github/workflows/stack-linter.yml index dea3d9a3..5db00510 100644 --- a/.github/workflows/stack-linter.yml +++ b/.github/workflows/stack-linter.yml @@ -41,6 +41,6 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: github/super-linter@v2.0.0 + uses: docker://github/super-linter:latest env: VALIDATE_ALL_CODEBASE: false From be35583eab5aa85c8ee715275ac7c2e6825330a3 Mon Sep 17 00:00:00 2001 From: SangND Date: Fri, 19 Jun 2020 02:10:08 +0700 Subject: [PATCH 05/23] README: fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fd43bf2..35fe49c8 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ jobs: ## Environment variables The super-linter allows you to pass the following `ENV` variables to be able to trigger different functionality. -*Note:* All the `VALIDATE_[LANGAUGE]` variables behave in a specific way. +*Note:* All the `VALIDATE_[LANGUAGE]` variables behave in a specific way. If none of them are passed, then they all default to true. However if any one of the variables are set, we default to leaving any unset variable to false. This means that if you run the linter "out of the box", all langauges will be checked. From e957ebf359ff32cc75575aa54ace13d26b666bfa Mon Sep 17 00:00:00 2001 From: Antoine Leblanc Date: Thu, 18 Jun 2020 21:14:22 +0200 Subject: [PATCH 06/23] Apply valid syntax to CODEOWNERS file see: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax Signed-off-by: Antoine Leblanc --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6606d7fd..c70dda77 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ ###################################################################### # These owners will be the default owners for everything in the repo # ###################################################################### -* @admiralawkbar, @jwiebalk, @zkoppert \ No newline at end of file +* @admiralawkbar @jwiebalk @zkoppert \ No newline at end of file From b9055439d3f148d68d714eae8996445336c11246 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Thu, 18 Jun 2020 14:42:33 -0500 Subject: [PATCH 07/23] more language --- .automation/cleanup-docker.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index ab333098..77b86ab3 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -1,7 +1,7 @@ #!/bin/bash ################################################################################ -############# Cleanup Container on DockerHub @admiralawkbar #################### +############# Cleanup Image on DockerHub @admiralawkbar ######################## ################################################################################ # NOTES: This script is used to remove a tagged image on DockerHub From 64189078119d28bd7a98c87ea1a9d4770407c03e Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 18 Jun 2020 22:13:20 +0200 Subject: [PATCH 08/23] docs(readme): fix typo languages --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35fe49c8..f60cdaad 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ The super-linter allows you to pass the following `ENV` variables to be able to *Note:* All the `VALIDATE_[LANGUAGE]` variables behave in a specific way. If none of them are passed, then they all default to true. However if any one of the variables are set, we default to leaving any unset variable to false. -This means that if you run the linter "out of the box", all langauges will be checked. +This means that if you run the linter "out of the box", all languages will be checked. But if you wish to select specific linters, we give you full control to choose which linters are run, and won't run anything unexpected. From 2ab14d961b3dfa0b7528d30529d7bfbe106d0384 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Thu, 18 Jun 2020 13:23:45 -0700 Subject: [PATCH 09/23] Update README to indicate support for non-master defaults --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 35fe49c8..681796d9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This repository is for the **GitHub Action** to run a **Super-Linter**. It is a simple combination of various linters, written in `bash`, to help validate your source code. The end goal of this tool: -- Prevent broken code from being uploaded to *master* branches +- Prevent broken code from being uploaded to the default branch (Usually `master`) branches - Help establish coding best practices across multiple languages - Build guidelines for code layout and format - Automate the process to help streamline code reviews From 33c2dd57f7de2300b5418a6966262bad9238d430 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Thu, 18 Jun 2020 14:04:41 -0700 Subject: [PATCH 10/23] Update explicit references to master Wherever the script previously used the master branch, we now substitute our DEFAULT_BRANCH variable. We also create this variable at the beginning of the script, and default it to master if no value was passed in. --- Dockerfile | 1 + lib/linter.sh | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 89eab906..84e50039 100644 --- a/Dockerfile +++ b/Dockerfile @@ -104,6 +104,7 @@ RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/r ENV GITHUB_SHA=${GITHUB_SHA} \ GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH} \ GITHUB_WORKSPACE=${GITHUB_WORKSPACE} \ + DEFAULT_BRANCH=${DEFAULT_BRANCH} \ VALIDATE_ALL_CODEBASE=${VALIDATE_ALL_CODEBASE} \ VALIDATE_YAML=${VALIDATE_YAML} \ VALIDATE_JSON=${VALIDATE_JSON} \ diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..624bb9b7 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -69,6 +69,7 @@ LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RUBY' 'PYTHON' GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace +DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}" # Default Git Branch to use (master by default) ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language @@ -1154,10 +1155,10 @@ BuildFileList() echo "Pulling in code history and branches..." fi - ##################################################################### - # Switch codebase back to master to get a list of all files changed # - ##################################################################### - SWITCH_CMD=$(cd "$GITHUB_WORKSPACE" || exit; git pull --quiet; git checkout master 2>&1) + ################################################################################# + # Switch codebase back to the default branch to get a list of all files changed # + ################################################################################# + SWITCH_CMD=$(cd "$GITHUB_WORKSPACE" || exit; git pull --quiet; git checkout "$DEFAULT_BRANCH" 2>&1) ####################### # Load the error code # @@ -1169,7 +1170,7 @@ BuildFileList() ############################## if [ $ERROR_CODE -ne 0 ]; then # Error - echo "Failed to switch to master branch to get files changed!" + echo "Failed to switch to $DEFAULT_BRANCH branch to get files changed!" echo "ERROR:[$SWITCH_CMD]" exit 1 fi @@ -1180,14 +1181,14 @@ BuildFileList() if [[ "$ACTIONS_RUNNER_DEBUG" == "true" ]]; then echo "" echo "----------------------------------------------" - echo "Generating Diff with:[git diff --name-only 'master..$GITHUB_SHA' --diff-filter=d]" + echo "Generating Diff with:[git diff --name-only '$DEFAULT_BRANCH..$GITHUB_SHA' --diff-filter=d]" fi ################################################ # Get the Array of files changed in the comits # ################################################ # shellcheck disable=SC2207 - RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "master..$GITHUB_SHA" --diff-filter=d 2>&1)) + RAW_FILE_ARRAY=($(cd "$GITHUB_WORKSPACE" || exit; git diff --name-only "$DEFAULT_BRANCH..$GITHUB_SHA" --diff-filter=d 2>&1)) ####################### # Load the error code # @@ -1910,7 +1911,7 @@ RunTestCases() { # This loop will run the test cases and exclude user code # This is called from the automation process to validate new code - # When a PR is opened, the new code is validated with the master branch + # When a PR is opened, the new code is validated with the default branch # version of linter.sh, and a new container is built with the latest codebase # for testing. That container is spun up, and ran, # with the flag: TEST_CASE_RUN=true From f4153396ae3f5d607eefb8dcb1140d64195250a0 Mon Sep 17 00:00:00 2001 From: Philip Mallegol-Hansen Date: Thu, 18 Jun 2020 14:06:52 -0700 Subject: [PATCH 11/23] Add documentation for the flag --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 681796d9..b7c8809f 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ and won't run anything unexpected. | **ENV VAR** | **Default Value** | **Notes** | | --- | --- | --- | | **VALIDATE_ALL_CODEBASE** | `true` | Will parse the entire repository and find all files to validate across all types. **NOTE:** When set to `false`, only **new** or **edited** files will be parsed for validation. | +| **DEFAULT_BRANCH** | `master` | The name of the repository default branch. | | **VALIDATE_YAML** | `true` |Flag to enable or disable the linting process of the language. | | **VALIDATE_JSON** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_XML** | `true` | Flag to enable or disable the linting process of the language. | From 41deecee1576e86169e2a7a6d892e1093459150d Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Thu, 18 Jun 2020 16:29:06 -0500 Subject: [PATCH 12/23] update coffeelint --- Dockerfile | 4 ++-- README.md | 2 +- docs/disabling-linters.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 89eab906..ff8496b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ RUN npm config set package-lock false \ && npm -g --no-cache install \ markdownlint-cli \ jsonlint prettyjson \ - coffeelint \ + @coffeelint/cli \ typescript eslint \ standard \ babel-eslint \ @@ -53,7 +53,7 @@ RUN npm config set package-lock false \ && npm --no-cache install \ markdownlint-cli \ jsonlint prettyjson \ - coffeelint \ + @coffeelint/cli \ typescript eslint \ standard \ babel-eslint \ diff --git a/README.md b/README.md index 35fe49c8..cd0a06e9 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | *Language* | *Linter* | | --- | --- | | **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) | -| **CoffeeScript** | [coffeelint](http://www.coffeelint.org/) | +| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) | | **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) | | **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) | | **JavaScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index a885c9f4..14e5139f 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -319,7 +319,7 @@ Here is more data -------------------------------------------------------------------------------- ## Coffeescript -- [coffeelint](http://www.coffeelint.org/) +- [coffeelint](https://coffeelint.github.io/) ### coffeelint Config file - `.github/linters/.coffee-lint.yml` From c4249ee93aecb3eeed99970c0f615ef751fee3a7 Mon Sep 17 00:00:00 2001 From: Nick Van Wiggeren Date: Thu, 18 Jun 2020 15:27:50 -0700 Subject: [PATCH 13/23] update docs to point to github docker image --- README.md | 2 +- docs/run-linter-locally.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f60cdaad..ef3de4fe 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ You can use the **GitHub** **Super-Linter** *with* or *without* your own persona If you need to disable certain *rules* and *functionality*, you can view [Disable Rules](https://github.com/github/super-linter/blob/master/docs/disabling-linters.md) ## Docker Hub -The **Docker** container that is built from this repository is located at `https://hub.docker.com/r/admiralawkbar/super-linter` +The **Docker** container that is built from this repository is located at `https://hub.docker.com/r/github/super-linter` ## Running Super-Linter locally (troubleshooting/debugging/enhancements) If you find that you need to run super-linter locally, you can follow the documentation at [Running super-linter locally](https://github.com/github/super-linter/blob/master/docs/run-linter-locally.md) diff --git a/docs/run-linter-locally.md b/docs/run-linter-locally.md index 06117349..d552f3f1 100644 --- a/docs/run-linter-locally.md +++ b/docs/run-linter-locally.md @@ -12,13 +12,13 @@ You can follow the link below on how to install and configure **Docker** on your ## Download the latest Super-Linter Docker container - Pull the latest **Docker** container down from **DockerHub** - - `docker pull admiralawkbar/super-linter:latest` + - `docker pull github/super-linter:latest` Once the container has been downloaded to your local environment, you can then begin the process, or running the container against your codebase. ## Run the container Locally - You can run the container locally with the following **Base** flags to run your code: - - `docker run -e RUN_LOCAL=true -v /path/to/local/codebase:/tmp/lint admiralawkbar/super-linter` - - To run against a single file you can use: `docker run -e RUN_LOCAL=true -v /path/to/local/codebase/file:/tmp/lint/file admiralawkbar/super-linter` + - `docker run -e RUN_LOCAL=true -v /path/to/local/codebase:/tmp/lint github/super-linter` + - To run against a single file you can use: `docker run -e RUN_LOCAL=true -v /path/to/local/codebase/file:/tmp/lint/file github/super-linter` - **NOTE:** You need to pass the `RUN_LOCAL` flag to bypass some of the GitHub Actions checks, as well as the mapping of your local codebase to `/tmp/lint` so that the linter can pick up the code - **NOTE:** The flag:`RUN_LOCAL` will set: `VALIDATE_ALL_CODEBASE` to true. This means it will scan **all** the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted @@ -29,7 +29,7 @@ You can add as many **Additional** flags as needed, documented in [README.md](.. ### Run container and gain access to the command line If you need to run the container locally and gain access to its command line, you can run the following command: -- `docker run -it --entrypoint /bin/bash admiralawkbar/super-linter` +- `docker run -it --entrypoint /bin/bash github/super-linter` - This will drop you in the command line of the docker container for any testing or troubleshooting that may be needed. ### Found issues From e22eb00151aae0a8beda1292790ef918dcc453f8 Mon Sep 17 00:00:00 2001 From: iggy Date: Thu, 18 Jun 2020 16:15:52 -0700 Subject: [PATCH 14/23] Update to latest golangci-lint In setting super-linter up on one of my repo's, I ran into golangci/golangci-lint#827 which is apparently fixed in v1.23.8 (and has improved error messages in v1.24.0). I'm not sure if there's a reason for using the version that is there now, but if the latest doesn't work, please at least update to 1.24.0. Signed-off-by: iggy --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 89eab906..50c5778c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -89,7 +89,7 @@ RUN wget -qO- "https://github.com/koalaman/shellcheck/releases/download/stable/s ##################### # Install Go Linter # ##################### -ARG GO_VERSION='v1.23.7' +ARG GO_VERSION='v1.27.0' RUN wget -O- -nvq https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s "$GO_VERSION" ################## From 2cf1ae7cd850882e2871c8b3a2667f1faff25032 Mon Sep 17 00:00:00 2001 From: altanstalker Date: Thu, 18 Jun 2020 19:40:41 -0400 Subject: [PATCH 15/23] Add stylelint support to super-linter Added tests Updated readme with usage notes (disabling lines etc) to match existing content --- .automation/test/css/README.md | 13 ++++++ .automation/test/css/css_bad_01.css | 9 ++++ .automation/test/css/css_good_01.css | 22 ++++++++++ .github/linters/.stylelintrc.json | 3 ++ Dockerfile | 7 ++- README.md | 2 + TEMPLATES/.stylelintrc.json | 3 ++ docs/disabling-linters.md | 33 ++++++++++++++ lib/linter.sh | 64 ++++++++++++++++++++++++++-- 9 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 .automation/test/css/README.md create mode 100644 .automation/test/css/css_bad_01.css create mode 100644 .automation/test/css/css_good_01.css create mode 100644 .github/linters/.stylelintrc.json create mode 100644 TEMPLATES/.stylelintrc.json diff --git a/.automation/test/css/README.md b/.automation/test/css/README.md new file mode 100644 index 00000000..04c7121a --- /dev/null +++ b/.automation/test/css/README.md @@ -0,0 +1,13 @@ +# CSS Test Cases +This folder holds the test cases for **CSS**. + +## Additional Docs +No Additional information is needed for this test case. + +## Good Test Cases +The test cases denoted: `LANGUAGE_good_FILE.EXTENSION` are all valid, and should pass successfully when linted. +- **Note:** They are linted utilizing the default linter rules. + +## Bad Test Cases +The test cases denoted: `LANGUAGE_bad_FILE.EXTENSION` are **NOT** valid, and should trigger errors when linted. +- **Note:** They are linted utilizing the default linter rules. diff --git a/.automation/test/css/css_bad_01.css b/.automation/test/css/css_bad_01.css new file mode 100644 index 00000000..3c600b36 --- /dev/null +++ b/.automation/test/css/css_bad_01.css @@ -0,0 +1,9 @@ +/* Bad */ +/* Multiline */ +/* Comment */ +.selector-3[type="text"] { + background: linear-gradient(#FFFFFF, rgba(0, 0, 0, 0.8)); + box-sizing: border-box; + display: block; + color: #AAAAAA; +} diff --git a/.automation/test/css/css_good_01.css b/.automation/test/css/css_good_01.css new file mode 100644 index 00000000..a126e5b2 --- /dev/null +++ b/.automation/test/css/css_good_01.css @@ -0,0 +1,22 @@ +/** + * Multi-line comment + */ + +.selector-1, +.selector-2, +.selector-3[type="text"] { + background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); + box-sizing: border-box; + display: block; + color: #333; +} + +.selector-a, +.selector-b:not(:first-child) { + padding: 10px !important; + top: calc(calc(1em * 2) / 3); +} + +.selector-x { width: 10%; } +.selector-y { width: 20%; } +.selector-z { width: 30%; } diff --git a/.github/linters/.stylelintrc.json b/.github/linters/.stylelintrc.json new file mode 100644 index 00000000..40db42c6 --- /dev/null +++ b/.github/linters/.stylelintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "stylelint-config-standard" +} diff --git a/Dockerfile b/Dockerfile index 89eab906..36e25542 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,6 +50,8 @@ RUN npm config set package-lock false \ @typescript-eslint/eslint-plugin \ @typescript-eslint/parser \ eslint-plugin-jest \ + stylelint \ + stylelint-config-standard \ && npm --no-cache install \ markdownlint-cli \ jsonlint prettyjson \ @@ -61,7 +63,9 @@ RUN npm config set package-lock false \ eslint-config-prettier \ @typescript-eslint/eslint-plugin \ @typescript-eslint/parser \ - eslint-plugin-jest + eslint-plugin-jest \ + stylelint \ + stylelint-config-standard #################################### # Install dockerfilelint from repo # @@ -122,6 +126,7 @@ ENV GITHUB_SHA=${GITHUB_SHA} \ VALIDATE_TYPESCRIPT_STANDARD=${VALIDATE_TYPESCRIPT_STANDARD} \ VALIDATE_GO=${VALIDATE_GO} \ VALIDATE_TERRAFORM=${VALIDATE_TERRAFORM} \ + VALIDATE_CSS=${VALIDATE_CSS} \ ANSIBLE_DIRECTORY=${ANSIBLE_DIRECTORY} \ RUN_LOCAL=${RUN_LOCAL} \ TEST_CASE_RUN=${TEST_CASE_RUN} \ diff --git a/README.md b/README.md index f60cdaad..85a10a5f 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | --- | --- | | **Ansible** | [ansible-lint](https://github.com/ansible/ansible-lint) | | **CoffeeScript** | [coffeelint](http://www.coffeelint.org/) | +| **CSS** | [stylelint](https://stylelint.io/) | | **Dockerfile** | [dockerfilelint](https://github.com/replicatedhq/dockerfilelint.git) | | **Golang** | [golangci-lint](https://github.com/golangci/golangci-lint) | | **JavaScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | @@ -130,6 +131,7 @@ and won't run anything unexpected. | **VALIDATE_DOCKER** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_GO** | `true` | Flag to enable or disable the linting process of the language. | | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | +| **VALIDATE_CSS** | `true` | Flag to enable or disable the linting process of the language. | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | diff --git a/TEMPLATES/.stylelintrc.json b/TEMPLATES/.stylelintrc.json new file mode 100644 index 00000000..40db42c6 --- /dev/null +++ b/TEMPLATES/.stylelintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "stylelint-config-standard" +} diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index a885c9f4..d425f078 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -20,6 +20,7 @@ Below is examples and documentation for each language and the various methods to - [Golang](#golang) - [Dockerfile](#dockerfile) - [Terraform](#terraform) +- [CSS](#stylelint) @@ -511,3 +512,35 @@ alert('foo') - There is currently **No** way to disable rules inline of the file(s) -------------------------------------------------------------------------------- + +## CSS +- [stylelint](https://stylelint.io/) + +### stylelint standard Config file +- `.github/linters/.stylelintrc.json` + +### stylelint disable single line +```css +#id { + /* stylelint-disable-next-line declaration-no-important */ + color: pink !important; +} +``` + +### stylelint disable code block +```css +/* stylelint-disable */ +a {} +/* stylelint-enable */ +``` + +### stylelint disable entire file +- You can disable entire files with the `ignoreFiles` property in `.stylelintrc.json` +```json +{ + "ignoreFiles": [ + "styles/ignored/wildcards/*.css", + "styles/ignored/specific-file.css" + ] +} +``` diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..84ec72b5 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -48,20 +48,25 @@ GO_LINTER_RULES="$DEFAULT_RULES_LOCATION/$GO_FILE_NAME" # Path to th # Terraform Vars TERRAFORM_FILE_NAME='.tflint.hcl' # Name of the file TERRAFORM_LINTER_RULES="$DEFAULT_RULES_LOCATION/$TERRAFORM_FILE_NAME" # Path to the Terraform lint rules +# CSS Vars +CSS_FILE_NAME='.stylelintrc.json' # Name of the file +CSS_LINTER_RULES="$DEFAULT_RULES_LOCATION/$CSS_FILE_NAME" # Path to the CSS lint rules + ####################################### # Linter array for information prints # ####################################### LINTER_ARRAY=("jsonlint" "yamllint" "xmllint" "markdownlint" "shellcheck" "pylint" "perl" "rubocop" "coffeelint" "eslint" "standard" - "ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint") + "ansible-lint" "/dockerfilelint/bin/dockerfilelint" "golangci-lint" "tflint" + "stylelint") ############################# # Language array for prints # ############################# LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RUBY' 'PYTHON' 'COFFEESCRIPT' 'ANSIBLE' 'JAVASCRIPT_STANDARD' 'JAVASCRIPT_ES' - 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM') + 'TYPESCRIPT_STANDARD' 'TYPESCRIPT_ES' 'DOCKER' 'GO' 'TERRAFORM' 'CSS') ################### # GitHub ENV Vars # @@ -88,6 +93,7 @@ VALIDATE_TYPESCRIPT_STANDARD="${VALIDATE_TYPESCRIPT_STANDARD}" # Boolean to val VALIDATE_DOCKER="${VALIDATE_DOCKER}" # Boolean to validate language VALIDATE_GO="${VALIDATE_GO}" # Boolean to validate language VALIDATE_TERRAFORM="${VALIDATE_TERRAFORM}" # Boolean to validate language +VALIDATE_CSS="${VALIDATE_CSS}" # Boolean to validate language TEST_CASE_RUN="${TEST_CASE_RUN}" # Boolean to validate only test cases ############## @@ -128,6 +134,7 @@ FILE_ARRAY_TYPESCRIPT_STANDARD=() # Array of files to check FILE_ARRAY_DOCKER=() # Array of files to check FILE_ARRAY_GO=() # Array of files to check FILE_ARRAY_TERRAFORM=() # Array of files to check +FILE_ARRAY_CSS=() # Array of files to check ############ # Counters # @@ -149,6 +156,7 @@ ERRORS_FOUND_TYPESCRIPT_ES=0 # Count of errors found ERRORS_FOUND_DOCKER=0 # Count of errors found ERRORS_FOUND_GO=0 # Count of errors found ERRORS_FOUND_TERRAFORM=0 # Count of errors found +ERRORS_FOUND_CSS=0 # Count of errors found ################################################################################ ########################## FUNCTIONS BELOW ##################################### @@ -725,6 +733,7 @@ GetValidationInfo() VALIDATE_DOCKER=$(echo "$VALIDATE_DOCKER" | awk '{print tolower($0)}') VALIDATE_GO=$(echo "$VALIDATE_GO" | awk '{print tolower($0)}') VALIDATE_TERRAFORM=$(echo "$VALIDATE_TERRAFORM" | awk '{print tolower($0)}') + VALIDATE_CSS=$(echo "$VALIDATE_CSS" | awk '{print tolower($0)') ################################################ # Determine if any linters were explicitly set # @@ -746,7 +755,8 @@ GetValidationInfo() -n "$VALIDATE_TYPESCRIPT_STANDARD" || \ -n "$VALIDATE_DOCKER" || \ -n "$VALIDATE_GO" || \ - -n "$VALIDATE_TERRAFORM" ]]; then + -n "$VALIDATE_TERRAFORM" || \ + -n "$VALIDATE_CSS" ]]; then ANY_SET="true" fi @@ -988,6 +998,20 @@ GetValidationInfo() VALIDATE_TERRAFORM="true" fi + ################################### + # Validate if we should check CSS # + ################################### + if [[ "$ANY_SET" == "true" ]]; then + # Some linter flags were set - only run those set to true + if [[ -z "$VALIDATE_CSS" ]]; then + # CSS flag was not set - default to false + VALIDATE_CSS="false" + fi + else + # No linter flags were set - default all to true + VALIDATE_CSS="true" + fi + ####################################### # Print which linters we are enabling # ####################################### @@ -1076,6 +1100,11 @@ GetValidationInfo() else PRINT_ARRAY+=("- Excluding [TERRAFORM] files in code base...") fi + if [[ "$VALIDATE_CSS" == "true" ]]; then + PRINT_ARRAY+=("- Validating [CSS] files in code base...") + else + PRINT_ARRAY+=("- Excluding [CSS] files in code base...") + fi ############################## # Validate Ansible Directory # @@ -1383,6 +1412,15 @@ BuildFileList() # Set the READ_ONLY_CHANGE_FLAG since this could be exec # ########################################################## READ_ONLY_CHANGE_FLAG=1 + elif [ "$FILE_TYPE" == "css" ]; then + ################################ + # Append the file to the array # + ################################ + FILE_ARRAY_CSS+=("$FILE") + ########################################################## + # Set the READ_ONLY_CHANGE_FLAG since this could be exec # + ########################################################## + READ_ONLY_CHANGE_FLAG=1 elif [ "$FILE" == "Dockerfile" ]; then ################################ # Append the file to the array # @@ -1888,7 +1926,8 @@ Footer() [ "$ERRORS_FOUND_DOCKER" -ne 0 ] || \ [ "$ERRORS_FOUND_GO" -ne 0 ] || \ [ "$ERRORS_FOUND_TERRAFORM" -ne 0 ] || \ - [ "$ERRORS_FOUND_RUBY" -ne 0 ]; then + [ "$ERRORS_FOUND_RUBY" -ne 0 ] || \ + [ "$ERRORS_FOUND_CSS" -ne 0 ]; then # Failed exit echo "Exiting with errors found!" exit 1 @@ -1945,6 +1984,7 @@ RunTestCases() TestCodebase "DOCKER" "/dockerfilelint/bin/dockerfilelint" "/dockerfilelint/bin/dockerfilelint" ".*\(Dockerfile\)\$" 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\)\$" ################# # Footer prints # @@ -1999,6 +2039,8 @@ GetLinterRules "$GO_FILE_NAME" "$GO_LINTER_RULES" GetLinterRules "$DOCKER_FILE_NAME" "$DOCKER_LINTER_RULES" # Get Terraform rules GetLinterRules "$TERRAFORM_FILE_NAME" "$TERRAFORM_LINTER_RULES" +# Get CSS rules +GetLinterRules "$CSS_FILE_NAME" "$CSS_LINTER_RULES" ################################# # Check if were in verbose mode # @@ -2214,6 +2256,20 @@ if [ "$VALIDATE_TYPESCRIPT_STANDARD" == "true" ]; then LintCodebase "TYPESCRIPT_STANDARD" "standard" "standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin $TYPESCRIPT_STANDARD_LINTER_RULES" ".*\.\(ts\)\$" "${FILE_ARRAY_TYPESCRIPT_STANDARD[@]}" fi +############### +# CSS LINTING # +############### +if [ "$VALIDATE_CSS" == "true" ]; then + ################################# + # Get CSS standard rules # + ################################# + GetStandardRules "stylelint" + ############################# + # Lint the CSS files # + ############################# + LintCodebase "CSS" "stylelint" "stylelint --config $CSS_LINTER_RULES" ".*\.\(css\)\$" "${FILE_ARRAY_CSS[@]}" +fi + ################## # DOCKER LINTING # ################## From fd416152eb24eacbc11afd824fd7a24ed8aa4b04 Mon Sep 17 00:00:00 2001 From: Zack Koppert Date: Thu, 18 Jun 2020 22:27:23 -0700 Subject: [PATCH 16/23] Update README.md Co-authored-by: Philip Mallegol-Hansen --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1981b2fa..6391bb73 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This repository is for the **GitHub Action** to run a **Super-Linter**. It is a simple combination of various linters, written in `bash`, to help validate your source code. The end goal of this tool: -- Prevent broken code from being uploaded to the default branch (Usually `master`) branches +- Prevent broken code from being uploaded to the default branch (Usually `master`) - Help establish coding best practices across multiple languages - Build guidelines for code layout and format - Automate the process to help streamline code reviews From 2751fb19a97a61b3c61921cd2545bd1e2f46daa3 Mon Sep 17 00:00:00 2001 From: Antoine Leblanc Date: Fri, 19 Jun 2020 07:44:26 +0200 Subject: [PATCH 17/23] Minor brand wording change Rename Github to GitHub. Signed-off-by: Antoine Leblanc --- .automation/cleanup-docker.sh | 4 ++-- .../test/ansible/ghe-initialize/defaults/main.yml | 2 +- .../ghe-initialize/tasks/ghe-initial-configuration.yml | 2 +- .automation/test/python/python_bad_1.py | 2 +- .automation/test/python/python_good_1.py | 2 +- .automation/upload-docker.sh | 4 ++-- Dockerfile | 4 ++-- lib/linter.sh | 10 +++++----- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.automation/cleanup-docker.sh b/.automation/cleanup-docker.sh index 77b86ab3..ba2cb758 100755 --- a/.automation/cleanup-docker.sh +++ b/.automation/cleanup-docker.sh @@ -16,7 +16,7 @@ ########### # Globals # ########### -GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace +GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image @@ -32,7 +32,7 @@ Header() { echo "" echo "-------------------------------------------------------" - echo "----- Github Actions remove image from DockerHub ------" + echo "----- GitHub Actions remove image from DockerHub ------" echo "-------------------------------------------------------" echo "" } diff --git a/.automation/test/ansible/ghe-initialize/defaults/main.yml b/.automation/test/ansible/ghe-initialize/defaults/main.yml index 6e8741f0..62e30a3a 100644 --- a/.automation/test/ansible/ghe-initialize/defaults/main.yml +++ b/.automation/test/ansible/ghe-initialize/defaults/main.yml @@ -62,7 +62,7 @@ core_expire_sessions: "false" core_package_version: "null" ####################### -# Default Github Vars # +# Default GitHub Vars # ####################### github_ssl_enabled: "true" github_ssl_tls_mode: "tlsv12" diff --git a/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml b/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml index d078873e..91865d3c 100644 --- a/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml +++ b/.automation/test/ansible/ghe-initialize/tasks/ghe-initial-configuration.yml @@ -74,7 +74,7 @@ ################################### # Set the GHE Admin Password fact # ################################### - - name: Set the Github Admin password fact + - name: Set the GitHub Admin password fact set_fact: github_admin_password: "{{ github_admin_password }}" diff --git a/.automation/test/python/python_bad_1.py b/.automation/test/python/python_bad_1.py index 843aad50..369a7224 100644 --- a/.automation/test/python/python_bad_1.py +++ b/.automation/test/python/python_bad_1.py @@ -89,7 +89,7 @@ def delete_label(label_id): Delete the specified label :param label_id: Label's node id. :type label_id: str - :return: Github API request response. + :return: GitHub API request response. """ query_variables = { diff --git a/.automation/test/python/python_good_1.py b/.automation/test/python/python_good_1.py index f808c297..e894c36f 100644 --- a/.automation/test/python/python_good_1.py +++ b/.automation/test/python/python_good_1.py @@ -88,7 +88,7 @@ def delete_label(label_id): Delete the specified label :param label_id: Label's node id. :type label_id: str - :return: Github API request response. + :return: GitHub API request response. """ query_variables = { diff --git a/.automation/upload-docker.sh b/.automation/upload-docker.sh index e6f42be1..644bee8d 100755 --- a/.automation/upload-docker.sh +++ b/.automation/upload-docker.sh @@ -17,7 +17,7 @@ ########### # Globals # ########### -GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace +GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace DOCKER_USERNAME="${DOCKER_USERNAME}" # Username to login to DockerHub DOCKER_PASSWORD="${DOCKER_PASSWORD}" # Password to login to DockerHub IMAGE_REPO="${IMAGE_REPO}" # Image repo to upload the image @@ -33,7 +33,7 @@ Header() { echo "" echo "-------------------------------------------------------" - echo "------ Github Actions Upload image to DockerHub -------" + echo "------ GitHub Actions Upload image to DockerHub -------" echo "-------------------------------------------------------" echo "" } diff --git a/Dockerfile b/Dockerfile index 89eab906..da74a9f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ FROM python:alpine # Label the instance and set maintainer # ######################################### LABEL com.github.actions.name="GitHub Super-Linter" \ - com.github.actions.description="Lint your code base with Github Actions" \ + com.github.actions.description="Lint your code base with GitHub Actions" \ com.github.actions.icon="code" \ com.github.actions.color="red" \ maintainer="GitHub DevOps " @@ -99,7 +99,7 @@ RUN curl -Ls "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/r && mv "tflint" /usr/bin/ ########################################### -# Load GitHub Env Vars for Github Actions # +# Load GitHub Env Vars for GitHub Actions # ########################################### ENV GITHUB_SHA=${GITHUB_SHA} \ GITHUB_EVENT_PATH=${GITHUB_EVENT_PATH} \ diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..473f53cd 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -67,8 +67,8 @@ LANGUAGE_ARRAY=('YML' 'JSON' 'XML' 'MARKDOWN' 'BASH' 'PERL' 'RUBY' 'PYTHON' # GitHub ENV Vars # ################### GITHUB_SHA="${GITHUB_SHA}" # GitHub sha from the commit -GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # Github Event Path -GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # Github Workspace +GITHUB_EVENT_PATH="${GITHUB_EVENT_PATH}" # GitHub Event Path +GITHUB_WORKSPACE="${GITHUB_WORKSPACE}" # GitHub Workspace ANSIBLE_DIRECTORY="${ANSIBLE_DIRECTORY}" # Ansible Directory VALIDATE_ALL_CODEBASE="${VALIDATE_ALL_CODEBASE}" # Boolean to validate all files VALIDATE_YAML="${VALIDATE_YAML}" # Boolean to validate language @@ -167,7 +167,7 @@ Header() ########## echo "" echo "---------------------------------------------" - echo "--- Github Actions Multi Language Linter ----" + echo "--- GitHub Actions Multi Language Linter ----" echo "---------------------------------------------" echo "" echo "---------------------------------------------" @@ -1963,9 +1963,9 @@ RunTestCases() Header ####################### -# Get Github Env Vars # +# Get GitHub Env Vars # ####################### -# Need to pull in all the Github variables +# Need to pull in all the GitHub variables # needed to connect back and update checks GetGitHubVars From d20d93fec3068fca5c8d03b31e3f56745a4eeb47 Mon Sep 17 00:00:00 2001 From: Jason Lenny Date: Fri, 19 Jun 2020 11:47:45 +0200 Subject: [PATCH 18/23] Allow for workspace location to be provided by the end user This will give more flexibility to anyone who doesn't happen to keep their files in /tmp/lint. --- lib/linter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linter.sh b/lib/linter.sh index 4ea4461b..3ca9dd3d 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -100,7 +100,7 @@ ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG}" # Boolean to see even more info # Default Vars # ################ DEFAULT_VALIDATE_ALL_CODEBASE='true' # Default value for validate all files -DEFAULT_WORKSPACE='/tmp/lint' # Default workspace if running locally +DEFAULT_WORKSPACE="${DEFAULT_WORKSPACE:-/tmp/lint}" # Default workspace if running locally DEFAULT_ANSIBLE_DIRECTORY="$GITHUB_WORKSPACE/ansible" # Default Ansible Directory DEFAULT_RUN_LOCAL='false' # Default value for debugging locally DEFAULT_TEST_CASE_RUN='false' # Flag to tell code to run only test cases From 14828eb478fbbe843ab1af973d2e2df0578ebb39 Mon Sep 17 00:00:00 2001 From: Jason Lenny Date: Fri, 19 Jun 2020 11:50:35 +0200 Subject: [PATCH 19/23] Add environment variable for running locally --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ef3de4fe..8e584d75 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,7 @@ and won't run anything unexpected. | **VALIDATE_TERRAFORM** | `true` | Flag to enable or disable the linting process of the language. | | **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s). | | **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. | +| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. | ### Template rules files You can use the **GitHub** **Super-Linter** *with* or *without* your own personal rules sets. This allows for greater flexibility for each individual code base. The Template rules all try to follow the standards we believe should be enabled at the basic level. From 248c421eda0031527e1461095269b4115f79ad8d Mon Sep 17 00:00:00 2001 From: Jason Lenny Date: Fri, 19 Jun 2020 11:52:14 +0200 Subject: [PATCH 20/23] Add instruction to running local page --- docs/run-linter-locally.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/run-linter-locally.md b/docs/run-linter-locally.md index d552f3f1..c28418b4 100644 --- a/docs/run-linter-locally.md +++ b/docs/run-linter-locally.md @@ -20,6 +20,7 @@ Once the container has been downloaded to your local environment, you can then b - `docker run -e RUN_LOCAL=true -v /path/to/local/codebase:/tmp/lint github/super-linter` - To run against a single file you can use: `docker run -e RUN_LOCAL=true -v /path/to/local/codebase/file:/tmp/lint/file github/super-linter` - **NOTE:** You need to pass the `RUN_LOCAL` flag to bypass some of the GitHub Actions checks, as well as the mapping of your local codebase to `/tmp/lint` so that the linter can pick up the code + - **NOTE:** If you want to override the `/tmp/lint` folder, you can set the `DEFAULT_WORKSPACE` environment variable to point to the folder you'd prefer to scan. - **NOTE:** The flag:`RUN_LOCAL` will set: `VALIDATE_ALL_CODEBASE` to true. This means it will scan **all** the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted ### Flags for running Locally From f81547ff33b59d09ddf19dbd85e98493af4e7674 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Fri, 19 Jun 2020 20:46:13 +0900 Subject: [PATCH 21/23] Update the notation of RuboCop RuboCop is the proper notation as below. > **RuboCop** is a Ruby static code analyzer (a.k.a. `linter`) and > code formatter. https://github.com/rubocop-hq/rubocop/blob/v0.85.1/README.md --- README.md | 2 +- docs/disabling-linters.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ef3de4fe..f1dfb044 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their code base | **Markdown** | [markdownlint](https://github.com/igorshubovych/markdownlint-cli#readme) | | **Perl** | [perl](https://pkgs.alpinelinux.org/package/edge/main/x86/perl) | | **Python3** | [pylint](https://www.pylint.org/) | -| **Ruby** | [Rubocop](https://github.com/rubocop-hq/rubocop) | +| **Ruby** | [RuboCop](https://github.com/rubocop-hq/rubocop) | | **Shell** | [Shellcheck](https://github.com/koalaman/shellcheck) | | **Terraform** | [tflint](https://github.com/terraform-linters/tflint) | | **TypeScript** | [eslint](https://eslint.org/) [standard js](https://standardjs.com/) | diff --git a/docs/disabling-linters.md b/docs/disabling-linters.md index a885c9f4..3adf8bfd 100644 --- a/docs/disabling-linters.md +++ b/docs/disabling-linters.md @@ -26,20 +26,20 @@ Below is examples and documentation for each language and the various methods to -------------------------------------------------------------------------------- ## Ruby -- [Rubocop](https://github.com/rubocop-hq/rubocop) +- [RuboCop](https://github.com/rubocop-hq/rubocop) -### Rubocop Config file +### RuboCop Config file - `.github/linters/.ruby-lint.yml` - You can pass multiple rules and overwrite default rules - File should be located at: `.github/linters/.ruby-lint.yml` -- **Note:** We use the Default **GitHub** Rule set from [Rubocop-GitHub](https://github.com/github/rubocop-github) +- **Note:** We use the Default **GitHub** Rule set from [RuboCop-GitHub](https://github.com/github/rubocop-github) -### Rubocop disable single line +### RuboCop disable single line ```ruby method(argument) # rubocop:disable SomeRule, SomeOtherRule ``` -### Rubocop disable code block +### RuboCop disable code block ```ruby # rubocop:disable This is a long line @@ -47,7 +47,7 @@ var="this is some other stuff" # rubocop:enable ``` -### Rubocop disable entire file +### RuboCop disable entire file If you need to ignore an entire file, you can update the `.github/linters/.ruby-lint.yml` to ignore certain files and locations ```yml From 7ee5d3d66a7e2c9db0bd4710f20833e49c010464 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 06:51:04 -0700 Subject: [PATCH 22/23] Fix Links Links pointed to github-demo which is 404, updated to point to super-linter --- .github/CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 960b4afe..f553dcfc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -40,6 +40,6 @@ If you are the current maintainer of this action: - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) - [GitHub Help](https://help.github.com) -[pulls]: https://github.com/github/github-demo-stack/pulls -[pr]: https://github.com/github/github-demo-stack/compare -[fork]: https://github.com/github/github-demo-stack/fork +[pulls]: https://github.com/github/super-linter/pulls +[pr]: https://github.com/github/super-linter/compare +[fork]: https://github.com/github/super-linter/fork From 1cb6bc76d285118aa46e6310df50c64a809e7607 Mon Sep 17 00:00:00 2001 From: Lucas Gravley <29484535+admiralAwkbar@users.noreply.github.com> Date: Fri, 19 Jun 2020 10:18:45 -0500 Subject: [PATCH 23/23] fixing docs --- README.md | 4 +++- TEMPLATES/README.md | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 541937e2..9e9ee22e 100644 --- a/README.md +++ b/README.md @@ -93,13 +93,15 @@ jobs: # Run Linter against code base # ################################ - name: Lint Code Base - uses: github/super-linter@v2.0.0 + uses: docker://github/super-linter:v2.0.0 env: VALIDATE_ALL_CODEBASE: false VALIDATE_ANSIBLE: false ... ``` +**NOTE:** Using the line:`uses: docker://github/super-linter:v2.0.0` will pull the image down from **DockerHub** and run the **GitHub Super-Linter**. Using the line: `uses: github/super-linter@v2.0.0` will build and compile the **GitHub Super-Linter** at build time. This can be far more costly in time... + ## Environment variables The super-linter allows you to pass the following `ENV` variables to be able to trigger different functionality. diff --git a/TEMPLATES/README.md b/TEMPLATES/README.md index bcd84269..c1ed7152 100644 --- a/TEMPLATES/README.md +++ b/TEMPLATES/README.md @@ -2,7 +2,5 @@ The files in this folder are template rules for the linters that will run against your code base. If you chose to copy these to your local repository in the directory: `.github/` they will be used at runtime. If they are not present, they will be used by default in the linter run. - - The file(s) will be parsed at run time on the local branch to load all rules needed to run the **Super-Linter** **GitHub** Action. The **GitHub** Action will inform the user via the **Checks API** on the status and success of the process.