-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description numerous times lately I have pushed commits that break our linting ( typically the end of file new line ) but on occasion also spacing changes. I've noticed others occasionally have the same issue. Setup a pre-commit check that runs the same linting command that `uds run lint` uses. If lint is successful the commit is made, if lint failed commit is not made and user is notified of what failed lint so they can fix. This also only tests staged files. Also could be built out a bit more to add restrictions to commit messages and other things if we wanted, or even logic to run the lint-fix ( which doesn't always work ). ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [x] Test, docs, adr added or updated as needed - [x] [Contributor Guide](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md) followed
- Loading branch information
1 parent
f94daf1
commit c3a2f62
Showing
15 changed files
with
1,138 additions
and
347 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,5 @@ | ||
# Lint Codespell configurations | ||
[codespell] | ||
skip = .codespellrc,.git,node_modules,build,dist,*.zst,CHANGELOG.md | ||
ignore-words-list = NotIn,AKS | ||
enable-colors = |
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,12 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
OUTPUT=$(npx lint-staged > /dev/null && echo $? || echo $?) | ||
|
||
if [ $OUTPUT -eq 0 ]; then | ||
echo "\n\n✅ Lint Check Passed. ✅\n\n" | ||
exit 0 | ||
else | ||
echo "\n\n❌ Lint Check failed... Run \`uds run lint-fix\` to resolve issues and re-commit. ❌\n\n" | ||
exit 1 | ||
fi |
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,11 @@ | ||
{ | ||
"*": [ | ||
"codespell" | ||
], | ||
"*.yaml": [ | ||
"yamllint -c .yamllint --no-warnings" | ||
], | ||
"*.ts": [ | ||
"npx pepr format --validate-only" | ||
] | ||
} |
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
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
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
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
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
Oops, something went wrong.