feat: allow exclusions in check fmt
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 1m4s
Some checks failed
Check Formatting of Files / Check-Formatting (push) Failing after 1m4s
This commit is contained in:
parent
3a6ed1915c
commit
196ea4bb85
@ -8,11 +8,32 @@ main() {
|
||||
root="$(git rev-parse --show-toplevel)"
|
||||
|
||||
local files=()
|
||||
local excluded_files=()
|
||||
local excluded_dirs=(
|
||||
"${root}/users/price/dots/.config/vesktop"
|
||||
)
|
||||
|
||||
while IFS= read -r file; do
|
||||
local add_file=true
|
||||
local fpath="${root}/${file}"
|
||||
if [[ -r "${fpath}" ]]; then
|
||||
files+=("${fpath}")
|
||||
if [[ -r "$fpath" ]]; then
|
||||
for excluded_dir in "${excluded_dirs[@]}"; do
|
||||
if [[ "$fpath" == "$excluded_dir"* ]]; then
|
||||
add_file=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for excluded_file in "${excluded_files[@]}"; do
|
||||
if [[ "$fpath" == "$excluded_file" ]]; then
|
||||
add_file=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$add_file" == true ]]; then
|
||||
files+=("$fpath")
|
||||
fi
|
||||
fi
|
||||
done < <(git diff --name-only --staged --diff-filter=d)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user