diff options
author | Bjorn Neergaard <bjorn@neersighted.com> | 2016-10-10 18:00:09 -0500 |
---|---|---|
committer | Bjorn Neergaard <bjorn@neersighted.com> | 2016-10-11 06:14:20 -0500 |
commit | ca4badfb3a0ae73d4fcac3512c8cfae2a6a94f03 (patch) | |
tree | f7cf1160d24261f3f46df6198bf0a69ff66e0561 /autoload | |
parent | 9a519684f2bc996e2d8dcb528bd53068291d10ed (diff) | |
download | ale-ca4badfb3a0ae73d4fcac3512c8cfae2a6a94f03.zip |
Use explicit scope in the ale core, as advised by vint -s
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale.vim | 20 | ||||
-rw-r--r-- | autoload/ale/cursor.vim | 76 | ||||
-rw-r--r-- | autoload/ale/engine.vim | 112 | ||||
-rw-r--r-- | autoload/ale/handlers.vim | 36 | ||||
-rw-r--r-- | autoload/ale/linter.vim | 20 | ||||
-rw-r--r-- | autoload/ale/sign.vim | 64 | ||||
-rw-r--r-- | autoload/ale/statusline.vim | 36 | ||||
-rw-r--r-- | autoload/ale/util.vim | 10 |
8 files changed, 186 insertions, 188 deletions
diff --git a/autoload/ale.vim b/autoload/ale.vim index b25bcc99..44cd5825 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -10,8 +10,8 @@ function! ale#Queue(delay) abort let s:lint_timer = -1 endif - let linters = ale#linter#Get(&filetype) - if len(linters) == 0 + let l:linters = ale#linter#Get(&filetype) + if len(l:linters) == 0 " There are no linters to lint with, so stop here. return endif @@ -24,18 +24,18 @@ function! ale#Queue(delay) abort endfunction function! ale#Lint(...) abort - let buffer = bufnr('%') - let linters = ale#linter#Get(&filetype) + let l:buffer = bufnr('%') + let l:linters = ale#linter#Get(&filetype) " Set a variable telling us to clear the loclist later. - let g:ale_buffer_should_reset_map[buffer] = 1 + let g:ale_buffer_should_reset_map[l:buffer] = 1 - for linter in linters + for l:linter in l:linters " Check if a given linter has a program which can be executed. - if has_key(linter, 'executable_callback') - let l:executable = ale#util#GetFunction(linter.executable_callback)(buffer) + if has_key(l:linter, 'executable_callback') + let l:executable = ale#util#GetFunction(l:linter.executable_callback)(l:buffer) else - let l:executable = linter.executable + let l:executable = l:linter.executable endif if !executable(l:executable) @@ -43,6 +43,6 @@ function! ale#Lint(...) abort continue endif - call ale#engine#Invoke(buffer, linter) + call ale#engine#Invoke(l:buffer, l:linter) endfor endfunction diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim index 71112b1a..0c5844e7 100644 --- a/autoload/ale/cursor.vim +++ b/autoload/ale/cursor.vim @@ -3,73 +3,73 @@ " Return a formatted message according to g:ale_echo_msg_format variable function! s:GetMessage(linter, type, text) abort - let msg = g:ale_echo_msg_format - let type = a:type ==# 'E' + let l:msg = g:ale_echo_msg_format + let l:type = a:type ==# 'E' \ ? g:ale_echo_msg_error_str \ : g:ale_echo_msg_warning_str " Capitalize the 1st character - let text = toupper(a:text[0]) . a:text[1:-1] + let l:text = toupper(a:text[0]) . a:text[1:-1] " Replace handlers if they exist - for [k, v] in items({'linter': a:linter, 'severity': type}) - let msg = substitute(msg, '\V%' . k . '%', v, '') + for [l:k, l:v] in items({'linter': a:linter, 'severity': l:type}) + let l:msg = substitute(l:msg, '\V%' . l:k . '%', l:v, '') endfor - return printf(msg, text) + return printf(l:msg, l:text) endfunction " This function will perform a binary search to find a message from the " loclist to echo when the cursor moves. function! s:BinarySearch(loclist, line, column) abort - let min = 0 - let max = len(a:loclist) - 1 - let last_column_match = -1 + let l:min = 0 + let l:max = len(a:loclist) - 1 + let l:last_column_match = -1 while 1 - if max < min - return last_column_match + if l:max < l:min + return l:last_column_match endif - let mid = (min + max) / 2 - let obj = a:loclist[mid] + let l:mid = (l:min + l:max) / 2 + let l:obj = a:loclist[l:mid] " Binary search to get on the same line - if a:loclist[mid]['lnum'] < a:line - let min = mid + 1 - elseif a:loclist[mid]['lnum'] > a:line - let max = mid - 1 + if a:loclist[l:mid]['lnum'] < a:line + let l:min = l:mid + 1 + elseif a:loclist[l:mid]['lnum'] > a:line + let l:max = l:mid - 1 else - let last_column_match = mid + let l:last_column_match = l:mid " Binary search to get the same column, or near it - if a:loclist[mid]['col'] < a:column - let min = mid + 1 - elseif a:loclist[mid]['col'] > a:column - let max = mid - 1 + if a:loclist[l:mid]['col'] < a:column + let l:min = l:mid + 1 + elseif a:loclist[l:mid]['col'] > a:column + let l:max = l:mid - 1 else - return mid + return l:mid endif endif endwhile endfunction function! ale#cursor#TruncatedEcho(message) abort - let message = a:message + let l:message = a:message " Change tabs to spaces. - let message = substitute(message, "\t", ' ', 'g') + let l:message = substitute(l:message, "\t", ' ', 'g') " Remove any newlines in the message. - let message = substitute(message, "\n", '', 'g') + let l:message = substitute(l:message, "\n", '', 'g') " We need to turn T for truncated messages on for shortmess, " and then then we need to reset the option back to what it was. - let shortmess_options = getbufvar('%', '&shortmess') + let l:shortmess_options = getbufvar('%', '&shortmess') try " Echo the message truncated to fit without creating a prompt. setlocal shortmess+=T exec "norm :echomsg message\n" finally - call setbufvar('%', '&shortmess', shortmess_options) + call setbufvar('%', '&shortmess', l:shortmess_options) endtry endfunction @@ -79,22 +79,20 @@ function! ale#cursor#EchoCursorWarning(...) abort return endif - let buffer = bufnr('%') + let l:buffer = bufnr('%') - if !has_key(g:ale_buffer_loclist_map, buffer) + if !has_key(g:ale_buffer_loclist_map, l:buffer) return endif - let loclist = g:ale_buffer_loclist_map[buffer] + let l:pos = getcurpos() + let l:loclist = g:ale_buffer_loclist_map[l:buffer] + let l:index = s:BinarySearch(l:loclist, l:pos[1], l:pos[2]) - let pos = getcurpos() - - let index = s:BinarySearch(loclist, pos[1], pos[2]) - - if index >= 0 - let l = loclist[index] - let msg = s:GetMessage(l.linter_name, l.type, l.text) - call ale#cursor#TruncatedEcho(msg) + if l:index >= 0 + let l:loc = l:loclist[l:index] + let l:msg = s:GetMessage(l:loc.linter_name, l:loc.type, l:loc.text) + call ale#cursor#TruncatedEcho(l:msg) else echo endif diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index c56e1c3c..7342a541 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -21,8 +21,8 @@ function! s:GetJobID(job) abort endfunction function! s:ClearJob(job) abort - let job_id = s:GetJobID(a:job) - let linter = s:job_info_map[job_id].linter + let l:job_id = s:GetJobID(a:job) + let l:linter = s:job_info_map[l:job_id].linter if has('nvim') call jobstop(a:job) @@ -36,18 +36,18 @@ function! s:ClearJob(job) abort call job_stop(a:job) endif - call remove(s:job_info_map, job_id) - call remove(linter, 'job') + call remove(s:job_info_map, l:job_id) + call remove(l:linter, 'job') endfunction function! s:GatherOutput(job, data) abort - let job_id = s:GetJobID(a:job) + let l:job_id = s:GetJobID(a:job) - if !has_key(s:job_info_map, job_id) + if !has_key(s:job_info_map, l:job_id) return endif - call extend(s:job_info_map[job_id].output, a:data) + call extend(s:job_info_map[l:job_id].output, a:data) endfunction function! s:GatherOutputVim(channel, data) abort @@ -64,48 +64,48 @@ function! s:HandleExit(job) abort return endif - let job_id = s:GetJobID(a:job) + let l:job_id = s:GetJobID(a:job) - if !has_key(s:job_info_map, job_id) + if !has_key(s:job_info_map, l:job_id) return endif - let job_info = s:job_info_map[job_id] + let l:job_info = s:job_info_map[l:job_id] call s:ClearJob(a:job) - let linter = job_info.linter - let output = job_info.output - let buffer = job_info.buffer + let l:linter = l:job_info.linter + let l:output = l:job_info.output + let l:buffer = l:job_info.buffer - let linter_loclist = ale#util#GetFunction(linter.callback)(buffer, output) + let l:linter_loclist = ale#util#GetFunction(l:linter.callback)(l:buffer, l:output) " Make some adjustments to the loclists to fix common problems. - call s:FixLocList(buffer, linter_loclist) + call s:FixLocList(l:buffer, l:linter_loclist) - for item in linter_loclist - let item.linter_name = linter.name + for l:item in l:linter_loclist + let l:item.linter_name = l:linter.name endfor - if g:ale_buffer_should_reset_map[buffer] - let g:ale_buffer_should_reset_map[buffer] = 0 - let g:ale_buffer_loclist_map[buffer] = [] + if g:ale_buffer_should_reset_map[l:buffer] + let g:ale_buffer_should_reset_map[l:buffer] = 0 + let g:ale_buffer_loclist_map[l:buffer] = [] endif " Add the loclist items from the linter. - call extend(g:ale_buffer_loclist_map[buffer], linter_loclist) + call extend(g:ale_buffer_loclist_map[l:buffer], l:linter_loclist) " Sort the loclist again. " We need a sorted list so we can run a binary search against it " for efficient lookup of the messages in the cursor handler. - call sort(g:ale_buffer_loclist_map[buffer], 'ale#util#LocItemCompare') + call sort(g:ale_buffer_loclist_map[l:buffer], 'ale#util#LocItemCompare') if g:ale_set_loclist - call setloclist(0, g:ale_buffer_loclist_map[buffer]) + call setloclist(0, g:ale_buffer_loclist_map[l:buffer]) endif if g:ale_set_signs - call ale#sign#SetSigns(buffer, g:ale_buffer_loclist_map[buffer]) + call ale#sign#SetSigns(l:buffer, g:ale_buffer_loclist_map[l:buffer]) endif " Mark line 200, column 17 with a squiggly line or something @@ -124,14 +124,14 @@ function! s:FixLocList(buffer, loclist) abort " Some errors have line numbers beyond the end of the file, " so we need to adjust them so they set the error at the last line " of the file instead. - let last_line_number = ale#util#GetLineCount(a:buffer) + let l:last_line_number = ale#util#GetLineCount(a:buffer) - for item in a:loclist - if item.lnum == 0 + for l:item in a:loclist + if l:item.lnum == 0 " When errors appear at line 0, put them at line 1 instead. - let item.lnum = 1 - elseif item.lnum > last_line_number - let item.lnum = last_line_number + let l:item.lnum = 1 + elseif l:item.lnum > l:last_line_number + let l:item.lnum = l:last_line_number endif endfor endfunction @@ -144,38 +144,38 @@ function! ale#engine#Invoke(buffer, linter) abort if has_key(a:linter, 'command_callback') " If there is a callback for generating a command, call that instead. - let command = ale#util#GetFunction(a:linter.command_callback)(a:buffer) + let l:command = ale#util#GetFunction(a:linter.command_callback)(a:buffer) else - let command = a:linter.command + let l:command = a:linter.command endif - if command =~# '%s' + if l:command =~# '%s' " If there is a '%s' in the command string, replace it with the name " of the file. - let command = printf(command, shellescape(fnamemodify(bufname(a:buffer), ':p'))) + let l:command = printf(l:command, shellescape(fnamemodify(bufname(a:buffer), ':p'))) endif if has('nvim') if a:linter.output_stream ==# 'stderr' " Read from stderr instead of stdout. - let job = jobstart(command, { + let l:job = jobstart(l:command, { \ 'on_stderr': 's:GatherOutputNeoVim', \ 'on_exit': 's:HandleExitNeoVim', \}) elseif a:linter.output_stream ==# 'both' - let job = jobstart(command, { + let l:job = jobstart(l:command, { \ 'on_stdout': 's:GatherOutputNeoVim', \ 'on_stderr': 's:GatherOutputNeoVim', \ 'on_exit': 's:HandleExitNeoVim', \}) else - let job = jobstart(command, { + let l:job = jobstart(l:command, { \ 'on_stdout': 's:GatherOutputNeoVim', \ 'on_exit': 's:HandleExitNeoVim', \}) endif else - let job_options = { + let l:job_options = { \ 'in_mode': 'nl', \ 'out_mode': 'nl', \ 'err_mode': 'nl', @@ -184,13 +184,13 @@ function! ale#engine#Invoke(buffer, linter) abort if a:linter.output_stream ==# 'stderr' " Read from stderr instead of stdout. - let job_options.err_cb = function('s:GatherOutputVim') + let l:job_options.err_cb = function('s:GatherOutputVim') elseif a:linter.output_stream ==# 'both' " Read from both streams. - let job_options.out_cb = function('s:GatherOutputVim') - let job_options.err_cb = function('s:GatherOutputVim') + let l:job_options.out_cb = function('s:GatherOutputVim') + let l:job_options.err_cb = function('s:GatherOutputVim') else - let job_options.out_cb = function('s:GatherOutputVim') + let l:job_options.out_cb = function('s:GatherOutputVim') endif if has('win32') @@ -204,20 +204,20 @@ function! ale#engine#Invoke(buffer, linter) abort " On Unix machines, we can send the Vim buffer directly. " This is faster than reading the lines ourselves. - let job_options.in_io = 'buffer' - let job_options.in_buf = a:buffer + let l:job_options.in_io = 'buffer' + let l:job_options.in_buf = a:buffer endif " Vim 8 will read the stdin from the file's buffer. - let job = job_start(l:command, l:job_options) + let l:job = job_start(l:command, l:job_options) endif " Only proceed if the job is being run. - if has('nvim') || (job !=# 'no process' && job_status(job) ==# 'run') - let a:linter.job = job + if has('nvim') || (l:job !=# 'no process' && job_status(l:job) ==# 'run') + let a:linter.job = l:job " Store the ID for the job in the map to read back again. - let s:job_info_map[s:GetJobID(job)] = { + let s:job_info_map[s:GetJobID(l:job)] = { \ 'linter': a:linter, \ 'buffer': a:buffer, \ 'output': [], @@ -225,18 +225,18 @@ function! ale#engine#Invoke(buffer, linter) abort if has('nvim') " In NeoVim, we have to send the buffer lines ourselves. - let input = join(getbufline(a:buffer, 1, '$'), "\n") . "\n" + let l:input = join(getbufline(a:buffer, 1, '$'), "\n") . "\n" - call jobsend(job, input) - call jobclose(job, 'stdin') + call jobsend(l:job, l:input) + call jobclose(l:job, 'stdin') elseif has('win32') " On some Vim versions, we have to send the buffer data ourselves. - let input = join(getbufline(a:buffer, 1, '$'), "\n") . "\n" - let channel = job_getchannel(job) + let l:input = join(getbufline(a:buffer, 1, '$'), "\n") . "\n" + let l:channel = job_getchannel(l:job) - if ch_status(channel) ==# 'open' - call ch_sendraw(channel, input) - call ch_close_in(channel) + if ch_status(l:channel) ==# 'open' + call ch_sendraw(l:channel, l:input) + call ch_close_in(l:channel) endif endif endif diff --git a/autoload/ale/handlers.vim b/autoload/ale/handlers.vim index 6a8bd246..e595ae48 100644 --- a/autoload/ale/handlers.vim +++ b/autoload/ale/handlers.vim @@ -10,17 +10,17 @@ function! ale#handlers#HandleGCCFormat(buffer, lines) abort " <stdin>:8:5: warning: conversion lacks type at end of format [-Wformat=] " <stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’) " -:189:7: note: $/${} is unnecessary on arithmetic variables. [SC2004] - let pattern = '^.\+:\(\d\+\):\(\d\+\): \([^:]\+\): \(.\+\)$' - let output = [] + let l:pattern = '^.\+:\(\d\+\):\(\d\+\): \([^:]\+\): \(.\+\)$' + let l:output = [] - for line in a:lines - let l:match = matchlist(line, pattern) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 continue endif - call add(output, { + call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, \ 'vcol': 0, @@ -31,7 +31,7 @@ function! ale#handlers#HandleGCCFormat(buffer, lines) abort \}) endfor - return output + return l:output endfunction function! ale#handlers#HandleCSSLintFormat(buffer, lines) abort @@ -42,35 +42,35 @@ function! ale#handlers#HandleCSSLintFormat(buffer, lines) abort " " These errors can be very massive, so the type will be moved to the front " so you can actually read the error type. - let pattern = '^.*: line \(\d\+\), col \(\d\+\), \(Error\|Warning\) - \(.\+\) (\([^)]\+\))$' - let output = [] + let l:pattern = '^.*: line \(\d\+\), col \(\d\+\), \(Error\|Warning\) - \(.\+\) (\([^)]\+\))$' + let l:output = [] - for line in a:lines - let l:match = matchlist(line, pattern) + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 continue endif - let text = l:match[4] - let type = l:match[3] - let errorGroup = l:match[5] + let l:text = l:match[4] + let l:type = l:match[3] + let l:errorGroup = l:match[5] " Put the error group at the front, so we can see what kind of error " it is on small echo lines. - let text = '(' . errorGroup . ') ' . text + let l:text = '(' . l:errorGroup . ') ' . l:text " vcol is Needed to indicate that the column is a character. - call add(output, { + call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, \ 'vcol': 0, \ 'col': l:match[2] + 0, - \ 'text': text, - \ 'type': type ==# 'Warning' ? 'W' : 'E', + \ 'text': l:text, + \ 'type': l:type ==# 'Warning' ? 'W' : 'E', \ 'nr': -1, \}) endfor - return output + return l:output endfunction diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index c87fa8df..010256d1 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -9,32 +9,32 @@ function! ale#linter#Define(filetype, linter) abort let s:linters[a:filetype] = [] endif - let new_linter = { + let l:new_linter = { \ 'name': a:linter.name, \ 'callback': a:linter.callback, \} if has_key(a:linter, 'executable_callback') - let new_linter.executable_callback = a:linter.executable_callback + let l:new_linter.executable_callback = a:linter.executable_callback else - let new_linter.executable = a:linter.executable + let l:new_linter.executable = a:linter.executable endif if has_key(a:linter, 'command_callback') - let new_linter.command_callback = a:linter.command_callback + let l:new_linter.command_callback = a:linter.command_callback else - let new_linter.command = a:linter.command + let l:new_linter.command = a:linter.command endif if has_key(a:linter, 'output_stream') - let new_linter.output_stream = a:linter.output_stream + let l:new_linter.output_stream = a:linter.output_stream else - let new_linter.output_stream = 'stdout' + let l:new_linter.output_stream = 'stdout' endif " TODO: Assert the value of the output_stream to be something sensible. - call add(s:linters[a:filetype], new_linter) + call add(s:linters[a:filetype], l:new_linter) endfunction function! ale#linter#Get(filetype) abort @@ -50,8 +50,8 @@ function! ale#linter#Get(filetype) abort if has_key(g:ale_linters, a:filetype) " Filter loaded linters according to list of linters specified in option. - for linter in g:ale_linters[a:filetype] - execute 'runtime! ale_linters/' . a:filetype . '/' . linter . '.vim' + for l:linter in g:ale_linters[a:filetype] + execute 'runtime! ale_linters/' . a:filetype . '/' . l:linter . '.vim' endfor else execute 'runtime! ale_linters/' . a:filetype . '/*.vim' diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim index 5cdd97c1..9aba8684 100644 --- a/autoload/ale/sign.vim +++ b/autoload/ale/sign.vim @@ -39,64 +39,64 @@ function! ale#sign#FindCurrentSigns(buffer) abort " Matches output like : " line=4 id=1 name=ALEErrorSign " строка=1 id=1000001 имя=ALEErrorSign - let pattern = 'id=\(\d\+\).*=ALE\(Warning\|Error\)Sign' + let l:pattern = 'id=\(\d\+\).*=ALE\(Warning\|Error\)Sign' - redir => output + redir => l:output silent exec 'sign place buffer=' . a:buffer redir END - let id_list = [] + let l:id_list = [] - for line in split(output, "\n") - let match = matchlist(line, pattern) + for l:line in split(l:output, "\n") + let l:match = matchlist(l:line, l:pattern) - if len(match) > 0 - call add(id_list, match[1] + 0) + if len(l:match) > 0 + call add(l:id_list, l:match[1] + 0) endif endfor - return id_list + return l:id_list endfunction " Given a loclist, combine the loclist into a list of signs such that only " one sign appears per line. Error lines will take precedence. " The loclist will have been previously sorted. function! ale#sign#CombineSigns(loclist) abort - let signlist = [] + let l:signlist = [] - for obj in a:loclist - let should_append = 1 + for l:obj in a:loclist + let l:should_append = 1 - if obj.lnum < 1 + if l:obj.lnum < 1 " Skip warnings and errors at line 0, etc. continue endif - if len(signlist) > 0 && signlist[-1].lnum == obj.lnum + if len(l:signlist) > 0 && l:signlist[-1].lnum == l:obj.lnum " We can't add the same line twice, because signs must be " unique per line. - let should_append = 0 + let l:should_append = 0 - if signlist[-1].type ==# 'W' && obj.type ==# 'E' + if l:signlist[-1].type ==# 'W' && l:obj.type ==# 'E' " If we had a warning previously, but now have an error, " we replace the object to set an error instead. - let signlist[-1] = obj + let l:signlist[-1] = l:obj endif endif - if should_append - call add(signlist, obj) + if l:should_append + call add(l:signlist, l:obj) endif endfor - return signlist + return l:signlist endfunction " This function will set the signs which show up on the left. function! ale#sign#SetSigns(buffer, loclist) abort - let signlist = ale#sign#CombineSigns(a:loclist) + let l:signlist = ale#sign#CombineSigns(a:loclist) - if len(signlist) > 0 || g:ale_sign_column_always + if len(l:signlist) > 0 || g:ale_sign_column_always if !get(g:ale_buffer_sign_dummy_map, a:buffer, 0) " Insert a dummy sign if one is missing. execute 'sign place ' . g:ale_sign_offset @@ -108,27 +108,27 @@ function! ale#sign#SetSigns(buffer, loclist) abort endif " Find the current signs with the markers we use. - let current_id_list = ale#sign#FindCurrentSigns(a:buffer) + let l:current_id_list = ale#sign#FindCurrentSigns(a:buffer) " Remove those markers. - for current_id in current_id_list - exec 'sign unplace ' . current_id . ' buffer=' . a:buffer + for l:current_id in l:current_id_list + exec 'sign unplace ' . l:current_id . ' buffer=' . a:buffer endfor " Now set all of the signs. - for i in range(0, len(signlist) - 1) - let obj = signlist[i] - let name = obj['type'] ==# 'W' ? 'ALEWarningSign' : 'ALEErrorSign' + for l:index in range(0, len(l:signlist) - 1) + let l:sign = l:signlist[l:index] + let l:type = l:sign['type'] ==# 'W' ? 'ALEWarningSign' : 'ALEErrorSign' - let sign_line = 'sign place ' . (i + g:ale_sign_offset + 1) - \. ' line=' . obj['lnum'] - \. ' name=' . name + let l:sign_line = 'sign place ' . (l:index + g:ale_sign_offset + 1) + \. ' line=' . l:sign['lnum'] + \. ' name=' . l:type \. ' buffer=' . a:buffer - exec sign_line + exec l:sign_line endfor - if !g:ale_sign_column_always && len(signlist) > 0 + if !g:ale_sign_column_always && len(l:signlist) > 0 if get(g:ale_buffer_sign_dummy_map, a:buffer, 0) execute 'sign unplace ' . g:ale_sign_offset . ' buffer=' . a:buffer diff --git a/autoload/ale/statusline.vim b/autoload/ale/statusline.vim index ded5283b..995fcd94 100644 --- a/autoload/ale/statusline.vim +++ b/autoload/ale/statusline.vim @@ -5,35 +5,35 @@ function! ale#statusline#Status() abort " Returns a formatted string that can be integrated in the " statusline - let buf = bufnr('%') - let bufLoclist = g:ale_buffer_loclist_map + let l:buffer = bufnr('%') + let l:loclist = g:ale_buffer_loclist_map - if !has_key(bufLoclist, buf) + if !has_key(l:loclist, l:buffer) return '' endif - let errors = 0 - let warnings = 0 - for e in bufLoclist[buf] - if e.type ==# 'E' - let errors += 1 + let l:errors = 0 + let l:warnings = 0 + for l:entry in l:loclist[l:buffer] + if l:entry.type ==# 'E' + let l:errors += 1 else - let warnings += 1 + let l:warnings += 1 endif endfor - let errors = errors ? printf(g:ale_statusline_format[0], errors) : '' - let warnings = warnings ? printf(g:ale_statusline_format[1], warnings) : '' - let no_errors = g:ale_statusline_format[2] + let l:errors = l:errors ? printf(g:ale_statusline_format[0], l:errors) : '' + let l:warnings = l:warnings ? printf(g:ale_statusline_format[1], l:warnings) : '' + let l:no_errors = g:ale_statusline_format[2] " Different formats if no errors or no warnings - if empty(errors) && empty(warnings) - let res = no_errors - elseif !empty(errors) && !empty(warnings) - let res = printf('%s %s', errors, warnings) + if empty(l:errors) && empty(l:warnings) + let l:res = l:no_errors + elseif !empty(l:errors) && !empty(l:warnings) + let l:res = printf('%s %s', l:errors, l:warnings) else - let res = empty(errors) ? warnings : errors + let l:res = empty(l:errors) ? l:warnings : l:errors endif - return res + return l:res endfunction diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim index e292c990..17ce7c44 100644 --- a/autoload/ale/util.vim +++ b/autoload/ale/util.vim @@ -2,16 +2,16 @@ " Description: Contains miscellaneous functions function! s:FindWrapperScript() abort - for parent in split(&runtimepath, ',') + for l:parent in split(&runtimepath, ',') " Expand the path to deal with ~ issues. - let path = expand(parent . '/' . 'stdin-wrapper') + let l:path = expand(l:parent . '/' . 'stdin-wrapper') - if filereadable(path) + if filereadable(l:path) if has('win32') - return path . '.exe' + return l:path . '.exe' endif - return path + return l:path endif endfor endfunction |