shellcheck, static usb ethnet addresses, fix vpn config
[distro-setup] / shellcheck-this-repo
diff --git a/shellcheck-this-repo b/shellcheck-this-repo
new file mode 100755 (executable)
index 0000000..926797c
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+this_file="$(readlink -f -- "${BASH_SOURCE[0]}")"
+readonly this_file this_dir="${this_file%/*}"
+cd "$this_dir"
+
+. .bashrc
+
+# "a", as in, pass to sk -a
+a_files=(
+  brc2
+  install-my-scripts
+)
+
+a_sourced_files=(
+  script-files
+  beet-data
+)
+
+declare -a ls_files standard_files
+
+# so, shellcheck doesn't like files that declare variables that are just
+# used in other files that source them. Using -a like this is the only
+# way to solve it. We can't just -a on everything because then we would
+# get various files I didn't write and that don't pass shellcheck.
+sk -a ${a_files[@]}
+
+
+tmp=$(git ls-files && git ls-files --others --exclude-standard)
+mapfile -t ls_files <<<"$tmp"
+for f in "${ls_files[@]}"; do
+  skip=false
+  for fignore in ${a_files[@]} ${a_sourced_files[@]}; do
+    if [[ $f == "$fignore" ]]; then
+      skip=true
+      break
+    fi
+  done
+  if $skip; then continue; fi
+  if sk-p "$f"; then
+    standard_files+=("$f")
+  fi
+done
+
+sk "${standard_files[@]}"