Skip to content

Commit

Permalink
pre-commit etc: add shfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 6, 2020
1 parent f0fe52c commit 08db11f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dir-locals.el
Expand Up @@ -4,5 +4,7 @@
((python-mode
(eval add-hook 'before-save-hook 'blacken-buffer nil t))
(sh-mode
(mode . shfmt-on-save)
(shfmt-arguments "-s")
(flycheck-sh-bash-args "-O" "extglob")
(sh-indent-comment . t)))
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -7,6 +7,9 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 79
# for shfmt
function_next_line = true
switch_case_indent = true

[Makefile.am]
indent_style = tab
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Expand Up @@ -30,6 +30,18 @@ repos:
args: [--config-file=test/setup.cfg]
# Intentionally not run on helpers/python (support very old versions)
exclude: completions/
- repo: https://github.com/scop/pre-commit-shfmt-workaround
rev: v0
hooks:
- id: shfmt
name: shfmt
language: golang
additional_dependencies: [mvdan.cc/sh/v3/cmd/shfmt@v3.1.1]
entry: shfmt
args: [-w, -s]
types: [text]
files: ^(bash_completion|completions/[^.].*|test/update-test-cmd-list|.+\.sh(\.in)?)$
exclude: ^completions/Makefile*
- repo: https://github.com/ryanrhee/shellcheck-py
rev: v0.7.1.1
hooks:
Expand Down

0 comments on commit 08db11f

Please sign in to comment.