From 5a8192e0420579d346e4e62ed4fa5b84723df5cf Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 13:52:54 +0300 Subject: [PATCH 1/6] add shellscripts check by shellcheck --- .github/workflows/check_shellscripts.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/check_shellscripts.yml diff --git a/.github/workflows/check_shellscripts.yml b/.github/workflows/check_shellscripts.yml new file mode 100644 index 000000000..08fafcb7b --- /dev/null +++ b/.github/workflows/check_shellscripts.yml @@ -0,0 +1,22 @@ +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 From 15b021659ef844328d5a48a69fca66edf74781d6 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:14:54 +0300 Subject: [PATCH 2/6] test add shfmt --- .editorconfig | 30 ++++++++++++++++++++++++ .github/workflows/check_shellscripts.yml | 22 +++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..2f58c3aec --- /dev/null +++ b/.editorconfig @@ -0,0 +1,30 @@ +# 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 diff --git a/.github/workflows/check_shellscripts.yml b/.github/workflows/check_shellscripts.yml index 08fafcb7b..151d631e9 100644 --- a/.github/workflows/check_shellscripts.yml +++ b/.github/workflows/check_shellscripts.yml @@ -20,3 +20,25 @@ jobs: ignore_paths: >- thirdparty thirdparty_unman + + shfmt: + name: Check shellscript formatting + needs: shellcheck + env: + SHFMT_VERSION: 3.0.1 + 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 . From 8612e49e781d65ae03e28cdaddaf72d6b9e4c46a Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:16:03 +0300 Subject: [PATCH 3/6] test add shfmt 2 --- .github/workflows/check_shellscripts.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/check_shellscripts.yml b/.github/workflows/check_shellscripts.yml index 151d631e9..63a53aaaf 100644 --- a/.github/workflows/check_shellscripts.yml +++ b/.github/workflows/check_shellscripts.yml @@ -23,9 +23,7 @@ jobs: shfmt: name: Check shellscript formatting - needs: shellcheck - env: - SHFMT_VERSION: 3.0.1 +# needs: shellcheck runs-on: ubuntu-latest steps: - name: Checkout repository code From 66d80d6af9951e25080040b51053dbc031c8af32 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:21:04 +0300 Subject: [PATCH 4/6] test add shfmt 3 --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 2f58c3aec..15c45842f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -28,3 +28,6 @@ ignore = true [thirdparty_unman/**] ignore = true + +[android/gradlew] +ignore = true From 5c7e3f83930ba52dd7d53991e281e9d6f8f0f1a6 Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:23:43 +0300 Subject: [PATCH 5/6] final version check shellscripts --- .github/workflows/check_shellscripts.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check_shellscripts.yml b/.github/workflows/check_shellscripts.yml index 63a53aaaf..fda77a078 100644 --- a/.github/workflows/check_shellscripts.yml +++ b/.github/workflows/check_shellscripts.yml @@ -23,7 +23,6 @@ jobs: shfmt: name: Check shellscript formatting -# needs: shellcheck runs-on: ubuntu-latest steps: - name: Checkout repository code From a501e9eab475cae5cf9893ee77a7ee9ccbc6f9dc Mon Sep 17 00:00:00 2001 From: Denis Patrakeev <72223799+den-patrakeev@users.noreply.github.com> Date: Thu, 26 Dec 2024 14:33:45 +0300 Subject: [PATCH 6/6] add info to main README --- .../{check_shellscripts.yml => check-shellscripts.yml} | 2 +- README.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) rename .github/workflows/{check_shellscripts.yml => check-shellscripts.yml} (97%) diff --git a/.github/workflows/check_shellscripts.yml b/.github/workflows/check-shellscripts.yml similarity index 97% rename from .github/workflows/check_shellscripts.yml rename to .github/workflows/check-shellscripts.yml index fda77a078..649f11530 100644 --- a/.github/workflows/check_shellscripts.yml +++ b/.github/workflows/check-shellscripts.yml @@ -1,4 +1,4 @@ -name: Check shellscripts +name: check-shellscripts on: push: 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.