Skip to content

Commit

Permalink
shfmt
Browse files Browse the repository at this point in the history
Ran `shfmt -w btrfs-auto-snapshot`. I am a fan of having a formatter
for the source files. Let me know what you think, I obviously respect if
you don't care as much (and we leave it as-is).

Also, as I am not a huge fan of third-party github actions, I opted to
install `shellcheck` to the ubuntu image and run it from there.

Diff best previewed in `git diff -w --word-diff`.
  • Loading branch information
motiejus committed May 3, 2024
1 parent edffcdd commit 8ab40c0
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 98 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ on: [push, pull_request]
name: 'Trigger: Push action'

jobs:
shellcheck:
name: Shellcheck
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
- uses: actions/checkout@v4
# TODO: running in alpine now, because `shfmt`
# of the current ubuntu instance lacks `--keep-padding`.
# Once ubuntu is upgraded to 24.04 or so, get rid of the
# containers.
- run: |
docker run -v $(pwd):/x -w /x -i --rm alpine <<EOF
apk add shellcheck shfmt make
make lint
EOF
- run: git diff --exit-code
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FILES = btrfs-auto-snapshot

.PHONY: lint
lint: shfmt shellcheck

.PHONY: shfmt
shfmt:
shfmt --keep-padding --func-next-line -i 4 -w $(FILES)

.PHONY: shellcheck
shellcheck:
shellcheck $(FILES)
Loading

0 comments on commit 8ab40c0

Please sign in to comment.