diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..cb1d8da --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.github/actionlint.yml b/.github/actionlint.yml new file mode 100644 index 0000000..00dc0c9 --- /dev/null +++ b/.github/actionlint.yml @@ -0,0 +1,4 @@ +--- +self-hosted-runner: + labels: [ ] +config-variables: [ ] diff --git a/.github/super-linter.env b/.github/super-linter.env new file mode 100644 index 0000000..cbc18ce --- /dev/null +++ b/.github/super-linter.env @@ -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 diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..a9efd08 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -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 }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16e5894 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/super-linter.log diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..ca2fb2a --- /dev/null +++ b/.vscode/tasks.json @@ -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}" + } + } + ] +} diff --git a/hwinfo/lshw.html b/hwinfo/lshw.html index 0e27c37..2050707 100644 --- a/hwinfo/lshw.html +++ b/hwinfo/lshw.html @@ -1681,3 +1681,4 @@ + diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 0000000..2ea9b3d --- /dev/null +++ b/scripts/lint @@ -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 ]" >&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