Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: super-linter support #26

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .editorconfig
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
4 changes: 4 additions & 0 deletions .github/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
self-hosted-runner:
labels: [ ]
config-variables: [ ]
7 changes: 7 additions & 0 deletions .github/super-linter.env
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
28 changes: 28 additions & 0 deletions .github/workflows/pr-checks.yml
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 }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/super-linter.log
18 changes: 18 additions & 0 deletions .vscode/tasks.json
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}"
}
}
]
}
1 change: 1 addition & 0 deletions hwinfo/lshw.html
Original file line number Diff line number Diff line change
Expand Up @@ -1681,3 +1681,4 @@
</div>
</body>
</html>
<!--- @generated --->
48 changes: 48 additions & 0 deletions scripts/lint
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