forked from vEnhance/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lint.sh
executable file
·28 lines (22 loc) · 882 Bytes
/
lint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -e # crash on any errors
readarray -t SPELL_FILES < <(git ls-files)
readarray -t PYTHON_FILES < <(git ls-files "**.py" | grep -v "qutebrowser/" | grep -v "ranger/")
readarray -t VIM_FILES < <(git ls-files "**.vim" vim/vimrc | grep -v "plug.vim")
readarray -t SHELL_FILES < <(git ls-files "**.sh")
# Spellcheck
echo "Running spellcheck on ${#SPELL_FILES[@]} files..."
codespell "${SPELL_FILES[@]}"
# Python
echo "Running pyflakes on ${#PYTHON_FILES[@]} files..."
pyflakes "${PYTHON_FILES[@]}"
echo "Running black on ${#PYTHON_FILES[@]} files..."
black --check "${PYTHON_FILES[@]}"
# Vim
echo "Running vint on ${#VIM_FILES[@]} files..."
vint -t "${VIM_FILES[@]}"
# Shell
echo "Running shfmt on ${#SHELL_FILES[@]} files..."
shfmt -i 2 -ci -d "${SHELL_FILES[@]}"
echo "Running shellcheck on ${#SHELL_FILES[@]} files..."
shellcheck --format=tty "${SHELL_FILES[@]}"