summaryrefslogtreecommitdiff
path: root/ale_linters/fortran
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-15 22:06:56 +0100
committerw0rp <devw0rp@gmail.com>2017-04-15 22:06:56 +0100
commit7682fab2947ea13b2427bfdf2b42c30168712f92 (patch)
tree780be6c292fe8a4b72889de898cb3a1fa58bf292 /ale_linters/fortran
parentd82446623094689686f41280a3eb45fb3336b69e (diff)
downloadale-7682fab2947ea13b2427bfdf2b42c30168712f92.zip
Fix #168 - Make the Fortran linter more configurable
Diffstat (limited to 'ale_linters/fortran')
-rw-r--r--ale_linters/fortran/gcc.vim27
1 files changed, 23 insertions, 4 deletions
diff --git a/ale_linters/fortran/gcc.vim b/ale_linters/fortran/gcc.vim
index 0f390852..9b66f449 100644
--- a/ale_linters/fortran/gcc.vim
+++ b/ale_linters/fortran/gcc.vim
@@ -1,6 +1,15 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: gcc for Fortran files
+" This option can be set to 0 to use -ffixed-form
+if !exists('g:ale_fortran_gcc_use_free_form')
+ let g:ale_fortran_gcc_use_free_form = 1
+endif
+
+if !exists('g:ale_fortran_gcc_executable')
+ let g:ale_fortran_gcc_executable = 'gcc'
+endif
+
" Set this option to change the GCC options for warnings for Fortran.
if !exists('g:ale_fortran_gcc_options')
let g:ale_fortran_gcc_options = '-Wall'
@@ -52,16 +61,26 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
return l:output
endfunction
+function! ale_linters#fortran#gcc#GetExecutable(buffer) abort
+ return g:ale_fortran_gcc_executable
+endfunction
+
function! ale_linters#fortran#gcc#GetCommand(buffer) abort
- return 'gcc -S -x f95 -fsyntax-only -ffree-form '
- \ . g:ale_fortran_gcc_options
- \ . ' -'
+ let l:layout_option = g:ale_fortran_gcc_use_free_form
+ \ ? '-ffree-form'
+ \ : '-ffixed-form'
+
+ return ale_linters#fortran#gcc#GetExecutable(a:buffer)
+ \ . ' -S -x f95 -fsyntax-only '
+ \ . l:layout_option . ' '
+ \ . g:ale_fortran_gcc_options . ' '
+ \ . '-'
endfunction
call ale#linter#Define('fortran', {
\ 'name': 'gcc',
\ 'output_stream': 'stderr',
-\ 'executable': 'gcc',
+\ 'executable_callback': 'ale_linters#fortran#gcc#GetExecutable',
\ 'command_callback': 'ale_linters#fortran#gcc#GetCommand',
\ 'callback': 'ale_linters#fortran#gcc#Handle',
\})