mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-20 04:55:20 -05:00
refactor: Add more checks to pre-commit
Updated existing pre-commit hooks and added some new hooks: - Remove trailing whitespace - Ensure every non-empty file ends with a new line - Check YAML file validity - Prevent adding large files - Ensure any scripts with shebangs are executable Added a GitHub action to run pre-commit on every commit. Removed any existing actions which duplicate pre-commit. Ran pre-commit on the codebase.
This commit is contained in:
committed by
Pete Johanson
parent
9c4f1e02d1
commit
32ae776c42
4
.github/workflows/build-user-config.yml
vendored
4
.github/workflows/build-user-config.yml
vendored
@@ -19,8 +19,8 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
archive_name:
|
||||
description: 'Archive output file name'
|
||||
default: 'firmware'
|
||||
description: "Archive output file name"
|
||||
default: "firmware"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
|
||||
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -131,7 +131,7 @@ jobs:
|
||||
for (const configuration of combinedUnique) {
|
||||
if (!perBoard[configuration.board])
|
||||
perBoard[configuration.board] = [];
|
||||
|
||||
|
||||
perBoard[configuration.board].push({
|
||||
shield: configuration.shield,
|
||||
'cmake-args': configuration['cmake-args'],
|
||||
@@ -234,7 +234,7 @@ jobs:
|
||||
};
|
||||
}
|
||||
} else if (hm.exposes) {
|
||||
return hm.exposes.flatMap(i =>
|
||||
return hm.exposes.flatMap(i =>
|
||||
metadata.interconnects[i].shields.flatMap(s => boardAndShield(hm, s))
|
||||
);
|
||||
} else {
|
||||
@@ -243,7 +243,7 @@ jobs:
|
||||
break;
|
||||
case "shield":
|
||||
if (hm.features && hm.features.includes("keys")) {
|
||||
return hm.requires.flatMap(i =>
|
||||
return hm.requires.flatMap(i =>
|
||||
metadata.interconnects[i].boards.flatMap(b => boardAndShield(b, hm))
|
||||
);
|
||||
} else {
|
||||
|
||||
29
.github/workflows/clang-format-lint.yml
vendored
29
.github/workflows/clang-format-lint.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: Clang Format
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/workflows/clang-format-lint.yml"
|
||||
- "app/boards/**/*.c"
|
||||
- "app/include/**/*.h"
|
||||
- "app/src/**"
|
||||
- "app/drivers/**/*.c"
|
||||
- "app/drivers/**/*.h"
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/workflows/clang-format-lint.yml"
|
||||
- "app/boards/**/*.c"
|
||||
- "app/include/**/*.h"
|
||||
- "app/src/**"
|
||||
- "app/drivers/**/*.c"
|
||||
- "app/drivers/**/*.h"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: DoozyX/clang-format-lint-action@v0.13
|
||||
with:
|
||||
source: "./app"
|
||||
extensions: "h,c"
|
||||
10
.github/workflows/doc-checks.yml
vendored
10
.github/workflows/doc-checks.yml
vendored
@@ -21,16 +21,6 @@ jobs:
|
||||
- name: ESLint
|
||||
run: npm run lint
|
||||
working-directory: docs
|
||||
prettier:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
working-directory: docs
|
||||
- name: Prettier check
|
||||
run: npm run prettier:check
|
||||
working-directory: docs
|
||||
typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -15,17 +15,6 @@ on:
|
||||
- "app/scripts/west_commands/metadata.py"
|
||||
|
||||
jobs:
|
||||
check-metadata-format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v3
|
||||
- uses: bahmutov/npm-install@v1
|
||||
with:
|
||||
working-directory: app
|
||||
- name: Prettier Check
|
||||
run: npm run prettier:check
|
||||
working-directory: app
|
||||
validate-metadata:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
|
||||
15
.github/workflows/pre-commit.yml
vendored
Normal file
15
.github/workflows/pre-commit.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
name: pre-commit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.x
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
Reference in New Issue
Block a user