diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..15c45842f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,33 @@ +# EditorConfig is awesome: https://editorconfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +[*.sh] +# like -i=4 +indent_style = space +indent_size = 4 + +# --language-variant +shell_variant = posix +binary_next_line = true +# --case-indent +switch_case_indent = true +space_redirects = true +keep_padding = true +# --func-next-line +function_next_line = true + +[thirdparty/**] +ignore = true + +[thirdparty_unman/**] +ignore = true + +[android/gradlew] +ignore = true diff --git a/.github/workflows/check-shellscripts.yml b/.github/workflows/check-shellscripts.yml new file mode 100644 index 000000000..649f11530 --- /dev/null +++ b/.github/workflows/check-shellscripts.yml @@ -0,0 +1,41 @@ +name: check-shellscripts + +on: + push: + branches: + - main + pull_request: + +jobs: + shellcheck: + name: Check shellscripts by shellcheck + runs-on: ubuntu-latest + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + + - name: Check shellscripts by shellcheck + uses: ludeeus/action-shellcheck@2.0.0 + with: + ignore_paths: >- + thirdparty + thirdparty_unman + + shfmt: + name: Check shellscript formatting + runs-on: ubuntu-latest + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + + - name: Install Golang + uses: actions/setup-go@v5 + with: + go-version: '1.22' + check-latest: true + + - name: Install shfmt + run: go install mvdan.cc/sh/v3/cmd/shfmt@latest + + - name: Check shellscripts by shfmt + run: shfmt -d . diff --git a/README.md b/README.md index d4995eeb4..69fcffe79 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ Sourceforge repository will be used as a mirror [![Join the chat at https://gitter.im/coolreader/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/coolreader/Lobby) +[![shell-lint](https://github.com/buggins/coolreader/workflows/check-shellscripts/badge.svg?branch=master)](https://github.com/buggins/coolreader/actions?query=workflow%3Acheck-shellscripts+branch%3Amaster) + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.