From 79286a45041274ee4f668e54e7748343ff0505f2 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 14:10:13 +0000 Subject: [PATCH 01/14] Fix: Add .gitattributes file to make development Windows-Friendly --- .gitattributes | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..5dc46e6b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf \ No newline at end of file From 66983a8706d0a7e389b61ff45be51f89da383d78 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 14:10:28 +0000 Subject: [PATCH 02/14] Fix: Add devcontainer.json to allow vscode users to develop in container directly from repository --- .devcontainer/devcontainer.json | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..b470e0aa --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.123.0/containers/docker-existing-dockerfile +{ + "name": "SUPER-LINTER", + + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. + "dockerFile": "..\\Dockerfile", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": null + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [] + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment the next line to run commands after the container is created - for example installing curl. + // "postCreateCommand": "apt-get update && apt-get install -y curl", + + // Uncomment when using a ptrace-based debugger like C++, Go, and Rust + // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], + + // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker. + // "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], + + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + // "remoteUser": "vscode" +} From 7d95b48a05b60d7807d40090fae30a18e848f3de Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 15:09:52 +0000 Subject: [PATCH 03/14] Fix: Add proper shell and bash debugging extension --- .devcontainer/devcontainer.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b470e0aa..1d430c89 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,11 +11,13 @@ // Set *default* container specific settings.json values on container create. "settings": { - "terminal.integrated.shell.linux": null + "terminal.integrated.shell.linux": "/bin/ash" }, // Add the IDs of extensions you want installed when the container is created. - "extensions": [] + "extensions": [ + "rogalmic.bash-debug" + ] // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], From a2cf5c643727fcefa88513fb90ffd8c2235e76f6 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 16:13:32 +0000 Subject: [PATCH 04/14] Feat: Add Launch.json for bash debugging --- .vscode/launch.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..744b2145 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,14 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "bashdb", + "request": "launch", + "name": "Bash-Debug (simplest configuration)", + "program": "${file}" + } + ] +} \ No newline at end of file From 9ce962cf6990997008a825274a55964dfa3f04f8 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 16:53:52 +0000 Subject: [PATCH 05/14] Feat: Automatically link automation test cases to /tmp/lint by default --- .devcontainer/devcontainer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1d430c89..48a0b66a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,13 +17,13 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ "rogalmic.bash-debug" - ] + ], // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Uncomment the next line to run commands after the container is created - for example installing curl. - // "postCreateCommand": "apt-get update && apt-get install -y curl", + "postCreateCommand": "ln -s /workspaces/super-linter/.automation/test /tmp/lint", // Uncomment when using a ptrace-based debugger like C++, Go, and Rust // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], From 8b47945eea851f9f1e55df5e8bfb65268923f098 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 16:54:23 +0000 Subject: [PATCH 06/14] Updated Launch.json --- .vscode/launch.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 744b2145..7e128dc6 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,8 +7,12 @@ { "type": "bashdb", "request": "launch", - "name": "Bash-Debug (simplest configuration)", - "program": "${file}" + "name": "Test Linter", + "program": ".vscode/testlinter.sh", + "internalConsoleOptions": "openOnSessionStart", + "presentation": { + "group": "aLinter" + } } ] } \ No newline at end of file From 7f23223ed5178db913b53a8c60e90069f933816a Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 16:54:36 +0000 Subject: [PATCH 07/14] Fix: Add testlinter file to force run_local --- .vscode/testlinter.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .vscode/testlinter.sh diff --git a/.vscode/testlinter.sh b/.vscode/testlinter.sh new file mode 100644 index 00000000..464c420e --- /dev/null +++ b/.vscode/testlinter.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export RUN_LOCAL=true +/workspaces/super-linter/lib/linter.sh \ No newline at end of file From 90a1f525b04a6ffde616805c902e8f6a37217e38 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 17:31:53 +0000 Subject: [PATCH 08/14] Feat: Make GITHUB_WORKSPACE overridable in RUN_LOCAL Mode --- lib/linter.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 473f53cd..6a81206f 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -579,6 +579,14 @@ GetGitHubVars() ########################################## echo "NOTE: ENV VAR [RUN_LOCAL] has been set to:[true]" echo "bypassing GitHub Actions variables..." + + ############################ + # Set the GITHUB_WORKSPACE # + ############################ + if [ -z "$GITHUB_WORKSPACE" ]; then + GITHUB_WORKSPACE="$DEFAULT_WORKSPACE" + fi + echo "Linting all files in mapped directory:[$DEFAULT_WORKSPACE]" # No need to touch or set the GITHUB_SHA @@ -586,10 +594,6 @@ GetGitHubVars() # No need to touch or set the GITHUB_ORG # No need to touch or set the GITHUB_REPO - ############################ - # Set the GITHUB_WORKSPACE # - ############################ - GITHUB_WORKSPACE="$DEFAULT_WORKSPACE" ################################# # Set the VALIDATE_ALL_CODEBASE # From 9bce2fecb9052370d918bed33b16ea40583a8803 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 17:32:09 +0000 Subject: [PATCH 09/14] Minor refinements --- .devcontainer/devcontainer.json | 2 +- .vscode/testlinter.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 48a0b66a..b3259b1f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,7 +23,7 @@ // "forwardPorts": [], // Uncomment the next line to run commands after the container is created - for example installing curl. - "postCreateCommand": "ln -s /workspaces/super-linter/.automation/test /tmp/lint", + //"postCreateCommand": "ln -s /workspaces/super-linter/.automation/test /tmp/lint", // Uncomment when using a ptrace-based debugger like C++, Go, and Rust // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], diff --git a/.vscode/testlinter.sh b/.vscode/testlinter.sh index 464c420e..1bc56ad8 100644 --- a/.vscode/testlinter.sh +++ b/.vscode/testlinter.sh @@ -1,3 +1,5 @@ #!/bin/bash +#At this point you can use the debug console to add export GITHUB_WORKSPACE=/path to test only a specific folder +#You can also use ln -s /path /tmp/lint as an alternative export RUN_LOCAL=true /workspaces/super-linter/lib/linter.sh \ No newline at end of file From fdc003eb9101a6c1e3dd5d51169b0cbfacde567f Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 17:48:17 +0000 Subject: [PATCH 10/14] Feat: Add Github Pull Requests Extension --- .devcontainer/devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b3259b1f..03dde16a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,6 +16,7 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ + "github.vscode-pull-request-github", "rogalmic.bash-debug" ], From 5064b0c67aa4fb981fe4693d573ce8258ad75af4 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 17:48:39 +0000 Subject: [PATCH 11/14] Fix: Default Linter to automation tests --- .vscode/launch.json | 1 + .vscode/testlinter.sh | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7e128dc6..a02e962c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,6 +9,7 @@ "request": "launch", "name": "Test Linter", "program": ".vscode/testlinter.sh", + "cwd": "${workspaceFolder}", "internalConsoleOptions": "openOnSessionStart", "presentation": { "group": "aLinter" diff --git a/.vscode/testlinter.sh b/.vscode/testlinter.sh index 1bc56ad8..40502987 100644 --- a/.vscode/testlinter.sh +++ b/.vscode/testlinter.sh @@ -1,5 +1,11 @@ #!/bin/bash #At this point you can use the debug console to add export GITHUB_WORKSPACE=/path to test only a specific folder #You can also use ln -s /path /tmp/lint as an alternative +#If you do neither, this will default to running against the test automation files +tmppath=/tmp/lint +if [ ! -L tmppath ]; then + ln -s $PWD/.automation/test $tmppath +fi + export RUN_LOCAL=true -/workspaces/super-linter/lib/linter.sh \ No newline at end of file +source $PWD/lib/linter.sh \ No newline at end of file From 211a22c329eaea54e13e9757e40c9d6bf1813262 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 12:03:30 -0700 Subject: [PATCH 12/14] Fix: Change ash to bash for default Terminal Co-authored-by: Antoine Leblanc --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 03dde16a..72190b10 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,7 +11,7 @@ // Set *default* container specific settings.json values on container create. "settings": { - "terminal.integrated.shell.linux": "/bin/ash" + "terminal.integrated.shell.linux": "/bin/bash" }, // Add the IDs of extensions you want installed when the container is created. From 524ebed9cde62baf1a2cfbcf3fba39c708878964 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Fri, 19 Jun 2020 21:14:17 +0000 Subject: [PATCH 13/14] Fix tmppath detection --- .vscode/testlinter.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/testlinter.sh b/.vscode/testlinter.sh index 40502987..f7e7eb79 100644 --- a/.vscode/testlinter.sh +++ b/.vscode/testlinter.sh @@ -3,7 +3,7 @@ #You can also use ln -s /path /tmp/lint as an alternative #If you do neither, this will default to running against the test automation files tmppath=/tmp/lint -if [ ! -L tmppath ]; then +if [ ! -L $tmppath ]; then ln -s $PWD/.automation/test $tmppath fi From 6705cf967602f96f859fce0cfc75d8de77f98c66 Mon Sep 17 00:00:00 2001 From: Justin Grote Date: Wed, 24 Jun 2020 14:19:24 -0700 Subject: [PATCH 14/14] Docs: Add note about vscode --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f1dfb044..a768514a 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,13 @@ Below are a list of the known limitations for the **GitHub Super-Linter**: ## How to contribute If you would like to help contribute to this **GitHub** Action, please see [CONTRIBUTING](https://github.com/github/super-linter/blob/master/.github/CONTRIBUTING.md) +### Visual Studio Code +You can checkout this repository using [Container Remote Development](https://code.visualstudio.com/docs/remote/containers), and debug the linter using the `Test Linter` task. +![Example](https://user-images.githubusercontent.com/15258962/85165778-2d2ce700-b21b-11ea-803e-3f6709d8e609.gif) + +We will also support [Github Codespaces](https://github.com/features/codespaces/) once it becomes available + + -------------------------------------------------------------------------------- ### License