summaryrefslogtreecommitdiff
path: root/test/script/custom-linting-rules
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-09-04 16:51:18 +0100
committerw0rp <devw0rp@gmail.com>2018-09-04 16:51:18 +0100
commitd476578a402763f2c6e4e0ada2eb345d0ac938d7 (patch)
tree77f5a61c6eada15821391ecb4f78b87fa8e406db /test/script/custom-linting-rules
parent8f2e1c393f74326979e1c74af8dc9b6ca8004778 (diff)
downloadale-d476578a402763f2c6e4e0ada2eb345d0ac938d7.zip
Improve ALE project style checking
* The project style linter now runs while you type. * Now the scripts for checking the project require blank lines. * Many style issues have been found and fixed.
Diffstat (limited to 'test/script/custom-linting-rules')
-rwxr-xr-xtest/script/custom-linting-rules15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/script/custom-linting-rules b/test/script/custom-linting-rules
index 7aafe995..77e87db4 100755
--- a/test/script/custom-linting-rules
+++ b/test/script/custom-linting-rules
@@ -60,10 +60,10 @@ check_errors() {
for directory in "${directories[@]}"; do
# shellcheck disable=SC2086
- while IFS= read -r match; do
+ while read -r; do
RETURN_CODE=1
- echo "$match $message"
- done < <(grep -n "$regex" $include_arg "$directory"/**/*.vim \
+ echo "$REPLY $message"
+ done < <(grep -H -n "$regex" $include_arg "$directory"/**/*.vim \
| grep -v 'no-custom-checks' \
| grep -o '^[^:]\+:[0-9]\+' \
| sed 's:^\./::')
@@ -126,4 +126,13 @@ check_errors '\(!=.\?\|isnot\) type(\[\])' "Use 'isnot v:t_list' instead"
check_errors '\(!=.\?\|isnot\) type({})' "Use 'isnot v:t_dict' instead"
check_errors '\(!=.\?\|isnot\) type(function([^)]\+))' "Use 'isnot v:t_func' instead"
+# Run a Python script to find lines that require padding around them. For
+# users without Python installed, we'll skip these checks. Travis CI will run
+# the script.
+if command -v python > /dev/null; then
+ if ! test/script/block-padding-checker "$directory"/**/*.vim; then
+ RETURN_CODE=1
+ fi
+fi
+
exit $RETURN_CODE