Merge pull request #304 from github/FixVSCodeDebug

Fix vs code debug
This commit is contained in:
Lukas Gravley 2020-06-29 09:25:14 -05:00 committed by GitHub
commit 54ae156900
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 85 additions and 8 deletions

10
.devcontainer/README.md Normal file
View file

@ -0,0 +1,10 @@
# Devcontainer
This file specifies to vscode how to run the container
For format details, see [documentation](https://aka.ms/vscode-remote/devcontainer.json) or this file's [README](https://github.com/microsoft/vscode-dev-containers/tree/v0.123.0/containers/docker-existing-dockerfile)
context: Sets the run context to one level up instead of the .devcontainer folder.
dockerFile: Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
settings: Set *default* container specific settings.json values on container create.
extensions: Add the IDs of extensions you want installed when the container is created.

View file

@ -0,0 +1,12 @@
{
"name": "SUPER-LINTER",
"context": "..",
"dockerFile": "..//Dockerfile",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"extensions": [
"github.vscode-pull-request-github",
"rogalmic.bash-debug"
]
}

3
.gitattributes vendored Normal file
View file

@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

16
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "bashdb",
"request": "launch",
"name": "Test Linter",
"program": ".vscode/testlinter.sh",
"cwd": "${workspaceFolder}",
"internalConsoleOptions": "openOnSessionStart",
"presentation": {
"group": "aLinter"
}
}
]
}

26
.vscode/testlinter.sh vendored Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env 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
###########
# GLOBALS #
###########
CODE_PATH='/tmp/lint' # Path to code base
##################
# Check the path #
##################
if [ ! -L $CODE_PATH ]; then
# Create symbolic link
ln -s "$PWD"/.automation/test $CODE_PATH
fi
#########################
# Export to run locally #
#########################
export RUN_LOCAL=true
# shellcheck disable=SC1091,SC1090
source "$PWD"/lib/linter.sh

View file

@ -208,6 +208,12 @@ 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

View file

@ -659,6 +659,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
@ -666,10 +674,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 #