-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a GitHub workflow that runs super-linter on all PRs. It configures super-linter using the super-linter.env file which sets env vars for the linter. It also adds a script to run the linter locally using the same env vars. A VSCode task was added which runs the script. Finally, a .editorconfig file was added to ensure the linting and editor settings are the same. Refs: #22 Signed-off-by: Jaremy Hatler <hatler.jaremy@gmail.com>
- Loading branch information
Showing
8 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This is the highest level config | ||
root = true | ||
|
||
# Default settings | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
insert_final_newline = true | ||
max_line_length = 120 | ||
trim_trailing_whitespace = true | ||
|
||
# Git commit messages | ||
[COMMIT_EDITMSG] | ||
max_line_length = 72 | ||
|
||
# Git merge messages | ||
[MERGE_MSG] | ||
max_line_length = 72 | ||
|
||
# Git tag messages | ||
[TAG_EDITMSG] | ||
max_line_length = 72 | ||
|
||
# Markdown files | ||
[*.md] | ||
max_line_length = unset | ||
|
||
# Shell scripts | ||
[*.sh] | ||
indent_style = space | ||
indent_size = 4 | ||
shell_variant = bash | ||
binary_next_line = true | ||
switch_case_indent = true | ||
space_redirects = false | ||
keep_padding = false | ||
function_next_line = false | ||
|
||
# Should be kept same as *.sh above | ||
[scripts/*] | ||
indent_style = space | ||
indent_size = 4 | ||
shell_variant = bash | ||
binary_next_line = true | ||
switch_case_indent = true | ||
space_redirects = false | ||
keep_padding = false | ||
function_next_line = false | ||
|
||
# github workflow files | ||
[.github/workflows/*.yml] | ||
max_line_length = unset | ||
|
||
# hardware info files | ||
[hwinfo/*] | ||
max_line_length = unset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
self-hosted-runner: | ||
labels: [ ] | ||
config-variables: [ ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DEFAULT_BRANCH=main | ||
GITHUB_ACTIONS_CONFIG_FILE=.github/actionlint.yml | ||
GIT_DISCOVERY_ACROSS_FILESYSTEM=true | ||
IGNORE_GENERATED_FILES=true | ||
IGNORE_GITIGNORED_FILES=true | ||
LINTER_RULES_PATH=. | ||
VALIDATE_ALL_CODEBASE=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
name: PR Checks | ||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
# For pull requests, cancel all currently-running jobs for this workflow | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Super Lint Codebase | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Super-Linter | ||
run: cat .github/super-linter.env >> "$GITHUB_ENV" | ||
|
||
- name: Lint Codebase | ||
uses: super-linter/super-linter/slim@v5.7.2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/super-linter.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Run lint script", | ||
"type": "process", | ||
"command": "./scripts/lint", | ||
"group": "test", | ||
"presentation": { | ||
"reveal": "always", | ||
"panel": "new" | ||
}, | ||
"options": { | ||
"cwd": "${workspaceFolder}" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1681,3 +1681,4 @@ | |
</div> | ||
</body> | ||
</html> | ||
<!--- @generated ---> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# Initialize variables | ||
_DEBUG=false | ||
_WORKSPACE="$(git rev-parse --show-toplevel)" | ||
|
||
# Provide a usage message on stderr and exit | ||
function usage() { | ||
echo "Usage: $0 [--debug|-d] [--workspace|-w <path>]" >&2 | ||
exit 1 | ||
} | ||
|
||
# Runs super-linter via docker | ||
function run_linter() { | ||
docker run --rm \ | ||
-w /tmp/lint \ | ||
-e ACTIONS_RUNNER_DEBUG="$_DEBUG" \ | ||
-e CREATE_LOG_FILE="$_DEBUG" \ | ||
-e RUN_LOCAL=true \ | ||
-e USE_FIND_ALGORITHM=true \ | ||
--env-file "$_WORKSPACE"/.github/super-linter.env \ | ||
-v "$_WORKSPACE":/tmp/lint ghcr.io/super-linter/super-linter:v5.7.2 | ||
} | ||
|
||
# Parse arguments | ||
while test $# != 0; do | ||
case "$1" in | ||
--debug | -d) | ||
_DEBUG=true | ||
;; | ||
--workspace | -w) | ||
shift | ||
_WORKSPACE="$1" | ||
;; | ||
--) | ||
shift | ||
break | ||
;; | ||
*) | ||
usage | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
run_linter |