diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..72190b10 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,37 @@ +// 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": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "github.vscode-pull-request-github", + "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": "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" ], + + // 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" +} 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 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..a02e962c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,19 @@ +{ + // 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": "Test Linter", + "program": ".vscode/testlinter.sh", + "cwd": "${workspaceFolder}", + "internalConsoleOptions": "openOnSessionStart", + "presentation": { + "group": "aLinter" + } + } + ] +} \ No newline at end of file diff --git a/.vscode/testlinter.sh b/.vscode/testlinter.sh new file mode 100644 index 00000000..f7e7eb79 --- /dev/null +++ b/.vscode/testlinter.sh @@ -0,0 +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 +source $PWD/lib/linter.sh \ No newline at end of file diff --git a/README.md b/README.md index 6f4799f2..38a83bf8 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,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 diff --git a/lib/linter.sh b/lib/linter.sh index 9099b04b..1b25ead7 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -605,6 +605,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 @@ -612,10 +620,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 #