]> Sergey Matveev's repositories - nnn.git/commitdiff
Add Makefile target shellcheck
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 16 Jul 2022 17:47:32 +0000 (23:17 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 18 Jul 2022 12:58:16 +0000 (18:28 +0530)
.circleci/config.yml
Makefile
misc/CONTRIBUTING.md
plugins/boom
plugins/cdpath
plugins/fzcd
plugins/fzopen
plugins/gutenread
plugins/imgur
plugins/mimelist

index cc9b83a698b923aa618b6de764e2a2352b307e34..51bc788108250fb4a0580ad083e00f551b060efb 100644 (file)
@@ -75,7 +75,7 @@ jobs:
             echo "########## clang-tidy-11 ##########"
             clang-tidy-11 src/* -- -I/usr/include -I/usr/include/ncursesw
             echo "########## shellcheck ##########"
-            find plugins/ -type f -not -name "*.md" -exec shellcheck -e SC1090,SC2230 {} +
+            find plugins/ -type f -not -name "*.md" -exec shellcheck {} +
 
   package-and-publish:
     machine: true
index 721d0b67b391a5c034c04c6c9e9bb96351e450aa..3eaa28b78fae7574cc6c7e2cb698fbc8c8d30201 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -261,6 +261,9 @@ musl:
        ./musl-static-ubuntu.sh 1
        rm ./musl-static-ubuntu.sh
 
+shellcheck:
+       find ./plugins/ -type f -not -name "*.md" -exec shellcheck {} +
+
 dist:
        mkdir -p nnn-$(VERSION)
        $(CP) -r $(DISTFILES) nnn-$(VERSION)
index 4fd61cd47eef38b5866a06b4c839417606811b89..5b06c5f5976fdf041a996b88fd36ba57ab2ff3f2 100644 (file)
@@ -7,9 +7,10 @@ Before suggesting changes, please read a bit about [the design principles nnn fo
 
 `nnn` follows the Linux kernel coding style closely. The C source code uses TABs and the plugins use 4 spaces for indentation.
 
-Changes should not break the patch framework. Please run `make checkpatches` before raising a PR.
+- Code changes should not break the patch framework. Please run `make checkpatches` to ensure.
+- Run `make shellcheck` if adding/modifying plugins.
 
-CI runs `shellcheck` on plugins. Please watch out for any failures if you are modifying/adding a plugin.
+CI runs patch framework sanity test and `shellcheck`. Please watch out for any failures after raising the PR.
 
 ## Resources
 The [wiki](https://github.com/jarun/nnn/wiki/Developer-guides) has some resources for developers you might be interested in: building, debugging...
index 77bb1b8c8401cb3d81d3470f7db9449ffcb2cd82..aab466fa0576b6fc33f400e0c16609b5b83390fa 100755 (executable)
@@ -9,7 +9,7 @@
 # Shell: POSIX compliant
 # Author: Arun Prakash Jana
 
-GUIPLAYER="${GUIPLAYER}"
+GUIPLAYER="${GUIPLAYER:-""}"
 NUMTRACKS="${NUMTRACKS:-100}"
 
 if [ -n "$GUIPLAYER" ]; then
index 4ef0da23edbffd97ee54977919b87ef6dc553bfd..663cb26a2ef7580613fd98c77f80fbfc7f7b4b48 100755 (executable)
@@ -16,6 +16,7 @@
 # Shell: POSIX compliant
 # Author: Yuri Kloubakov
 
+# shellcheck disable=SC1090,SC1091
 . "$(dirname "$0")"/.nnn-plugin-helper
 
 # Get a list of (symbolic links to) directories for every element of CDPATH
index 28bd67e78b317c222b415a674cc1003d89b0249f..125092cbf3d29200ff1a452deee4aae63d582533 100755 (executable)
 
 IFS="$(printf '\n\r')"
 
+# shellcheck disable=SC1090,SC1091
 . "$(dirname "$0")"/.nnn-plugin-helper
 
 CTX=+
-LIST="$LIST"
+LIST="${LIST:-""}"
 
 if ! type fzf >/dev/null 2>&1; then
     printf "fzf missing"
index 57035b5cae72b2a6e4d96408f87b49aa5c1eb662..17b0585633ff21bfd9596c089ab02d3776ad8489 100755 (executable)
@@ -20,6 +20,7 @@
 NUKE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
 USE_NUKE=0
 
+# shellcheck disable=SC1090,SC1091
 . "$(dirname "$0")"/.nnn-plugin-helper
 
 if type fzf >/dev/null 2>&1; then
index ba41facd8c6b662a867b452d63feca0be1dfd714..036ff35145282328964b78a860d6d9cc7411d4c5 100755 (executable)
 # Shell: POSIX compliant
 # Author: Arun Prakash Jana
 
-EBOOK_ID="${EBOOK_ID}"
+EBOOK_ID="${EBOOK_ID:-""}"
 DIR="${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/$EBOOK_ID"
 BROWSE_LINK="https://www.gutenberg.org/ebooks/search/?sort_order=downloads"
 BROWSER="${BROWSER:-w3m}"
-READER="${READER}"
+READER="${READER:-""}"
 
 if [ -n "$EBOOK_ID" ]; then
     if [ ! -e "$DIR" ]; then
index 373de0551609414c7ee78e311e6ef301973c1c30..16d21bcd0c2ba57b5dbec49fcfd5c03bb3be78be 100755 (executable)
@@ -112,6 +112,7 @@ check_update="true"
 
 settings_path="${HOME}/.config/imgur-screenshot/settings.conf"
 if [ -f "${settings_path}" ]; then
+  # shellcheck disable=SC1090
   source "${settings_path}"
 fi
 
@@ -204,6 +205,7 @@ function load_access_token() {
   token_expire_time=0
   # check for saved access_token and its expiration date
   if [ -f "${credentials_file}" ]; then
+    # shellcheck disable=SC1090
     source "${credentials_file}"
   fi
   current_time="$(date +%s)"
index 586cc7cd1b507356070796e422ff8df7d8f38670..ccfe05a96c7d6b6110ac2b6687ccdf003f3b5207 100755 (executable)
@@ -5,6 +5,7 @@
 # Shell: POSIX compliant
 # Author: Arun Prakash Jana
 
+# shellcheck disable=SC1090,SC1091
 . "$(dirname "$0")"/.nnn-plugin-helper
 
 printf "mime (e.g., video/audio/image): "