X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=shellcheck-this-repo;fp=shellcheck-this-repo;h=926797ccc3541a171835825774f52eb72b05d8ae;hb=1f027ea146ea6c62002a8f67f831273a5c431b52;hp=0000000000000000000000000000000000000000;hpb=ef3bbffe6d2a08ebd735ba4f09c7bd0fbea585a0;p=distro-setup diff --git a/shellcheck-this-repo b/shellcheck-this-repo new file mode 100755 index 0000000..926797c --- /dev/null +++ b/shellcheck-this-repo @@ -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[@]}"