From 7682fab2947ea13b2427bfdf2b42c30168712f92 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sat, 15 Apr 2017 22:06:56 +0100 Subject: Fix #168 - Make the Fortran linter more configurable --- ale_linters/fortran/gcc.vim | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'ale_linters/fortran/gcc.vim') 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 " 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', \}) -- cgit v1.2.3