Add linters
This commit is contained in:
11
tools/install_linter
Executable file
11
tools/install_linter
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
tools_bin_dir="${BASH_SOURCE%/*}"
|
||||
download_url=https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
|
||||
version=v1.29.0
|
||||
|
||||
if ! curl -sfL "$download_url" | sh -s -- -b "$tools_bin_dir/bin" "$version"; then
|
||||
printf "Something went wrong while installing golangci-lint\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
11
tools/whitespace_linter
Executable file
11
tools/whitespace_linter
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# git 1.9.0+ allows for exclusions in pathspecs via ':!foo' syntax.
|
||||
# However, until git 2.13.0 there must be at least one "inclusive" pathspec, hence the './*'
|
||||
trailing_whitespace=$(git grep -E -n -- ' +$' -- './*' ':!*.png')
|
||||
|
||||
if [[ -n "$trailing_whitespace" ]]; then
|
||||
printf "ERROR: Trailing whitespaces:\n"
|
||||
awk 'BEGIN {FS=":"} {printf " * %s:%s\n", $1, $2}' <<< "$trailing_whitespace"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user