summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Korondi <korondi.mark@gmail.com>2017-06-08 19:26:21 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-06-08 18:26:21 +0100
commit64ad51048d8f490b57ca6e74864f4de3777ec2a7 (patch)
treec657a7dccd67de80518d56d90dc55b39c5bd88c1
parent62862c334776e3138f5a5456ed41bb146969b2c2 (diff)
downloadale-64ad51048d8f490b57ca6e74864f4de3777ec2a7.zip
Support for GNU Awk linting (#638)
* GNU Awk linter support * Documentation for awk linter
-rw-r--r--README.md1
-rw-r--r--ale_linters/awk/gawk.vim26
-rw-r--r--doc/ale-awk.txt25
3 files changed, 52 insertions, 0 deletions
diff --git a/README.md b/README.md
index 01998c50..5aa4ff87 100644
--- a/README.md
+++ b/README.md
@@ -58,6 +58,7 @@ name. That seems to be the fairest way to arrange this table.
| ASM | [gcc](https://gcc.gnu.org) |
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
| AsciiDoc | [proselint](http://proselint.com/)|
+| Awk | [gawk](https://www.gnu.org/software/gawk/)|
| Bash | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
| Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
diff --git a/ale_linters/awk/gawk.vim b/ale_linters/awk/gawk.vim
new file mode 100644
index 00000000..ac6e9154
--- /dev/null
+++ b/ale_linters/awk/gawk.vim
@@ -0,0 +1,26 @@
+" Author: kmarc <korondi.mark@gmail.com>
+" Description: This file adds support for using GNU awk with sripts.
+
+let g:ale_awk_gawk_executable =
+\ get(g:, 'ale_awk_gawk_executable', 'gawk')
+
+let g:ale_awk_gawk_options =
+\ get(g:, 'ale_awk_gawk_options', '')
+
+function! ale_linters#awk#gawk#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'awk_gawk_executable')
+endfunction
+
+function! ale_linters#awk#gawk#GetCommand(buffer) abort
+ return ale_linters#awk#gawk#GetExecutable(a:buffer)
+ \ . ' ' . ale#Var(a:buffer, 'awk_gawk_options')
+ \ . ' ' . '-f %t --lint /dev/null'
+endfunction
+
+call ale#linter#Define('awk', {
+\ 'name': 'gawk',
+\ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable',
+\ 'command_callback': 'ale_linters#awk#gawk#GetCommand',
+\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
+\ 'output_stream': 'both'
+\})
diff --git a/doc/ale-awk.txt b/doc/ale-awk.txt
new file mode 100644
index 00000000..221bf8de
--- /dev/null
+++ b/doc/ale-awk.txt
@@ -0,0 +1,25 @@
+===============================================================================
+ALE Awk Integration *ale-awk-options*
+
+
+-------------------------------------------------------------------------------
+gawk *ale-awk-gawk*
+
+g:ale_awk_gawk_executable *g:ale_awk_gawk_executable*
+ *b:ale_awk_gawk_executable*
+ Type: |String|
+ Default: `'gawk'`
+
+ This variable sets executable used for gawk.
+
+
+g:ale_awk_gawk_options *g:ale_awk_gawk_options*
+ *b:ale_awk_gawk_options*
+ Type: |String|
+ Default: `''`
+
+ With this variable we are able to pass extra arguments for gawk
+ for invocation.
+
+-------------------------------------------------------------------------------
+ vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: