-
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.
Add pre-commit git hook file Fix lint errors. Signed-off-by: Nathaniel Clark <[email protected]>
- Loading branch information
1 parent
46ea959
commit 2b6a801
Showing
6 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rpn-rs" | ||
version = "0.1.3" | ||
version = "0.1.4" | ||
authors = ["Nathaniel Clark <[email protected]>"] | ||
edition = "2021" | ||
keywords = [ "fltk", "rpn", "calculator", "tui" ] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# | ||
# rustfmt edition should match what is present in Cargo.toml | ||
# weblint is provided by the HTML::Lint perl package | ||
|
||
HAS_ISSUES=false | ||
|
||
for file in $(git diff --name-only --staged); do | ||
FMT_RESULT="" | ||
if [ ! -e $file ]; then | ||
continue | ||
fi | ||
case "$file" in | ||
*.rs) FMT_RESULT="$(rustfmt --edition 2021 --check $file 2>/dev/null || true)" ;; | ||
*.html) [ -n "$(which weblint)" ] && FMT_RESULT="$(weblint $file)" ;; | ||
*.md) [ -n "$(which mdl)" ] && FMT_RESULT="$(mdl $file)" ;; | ||
esac | ||
|
||
if [ -n "$FMT_RESULT" ]; then | ||
if $HAS_ISSUES; then | ||
echo -n ", " | ||
fi | ||
echo -n "$file" | ||
HAS_ISSUES=true | ||
fi | ||
done | ||
|
||
if $HAS_ISSUES; then | ||
echo -e "\nYour code has formatting issues in files listed above. Format your code!" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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