mirror of
https://github.com/dense-analysis/ale.git
synced 2026-11-18 17:51:03 +08:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d68ec7857 | ||
|
|
e670c9781c | ||
|
|
0d1d0a9f81 | ||
|
|
c8890af8d4 | ||
|
|
9abe393961 | ||
|
|
4b1bf3ee8f | ||
|
|
edccdfa9ef |
No files matched your search
@@ -1,6 +1,7 @@
|
||||
call ale#Set('ruby_sorbet_executable', 'srb')
|
||||
call ale#Set('ruby_sorbet_options', '')
|
||||
call ale#Set('ruby_sorbet_enable_watchman', 0)
|
||||
call ale#Set('ruby_sorbet_initialization_options', { 'highlightUntyped': v:false })
|
||||
|
||||
function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable')
|
||||
@@ -21,6 +22,6 @@ call ale#linter#Define('ruby', {
|
||||
\ 'language': 'ruby',
|
||||
\ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')},
|
||||
\ 'command': function('ale_linters#ruby#sorbet#GetCommand'),
|
||||
\ 'project_root': function('ale#ruby#FindProjectRoot')
|
||||
\ 'project_root': function('ale#ruby#FindProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#Var(b, 'ruby_sorbet_initialization_options')}
|
||||
\})
|
||||
|
||||
@@ -9,7 +9,9 @@ endif
|
||||
" --lint-only
|
||||
function! ale_linters#verilog#slang#GetCommand(buffer) abort
|
||||
return 'slang -Weverything '
|
||||
\ . '--diag-abs-paths '
|
||||
\ . '-I%s:h '
|
||||
\ . '-y%s:h '
|
||||
\ . ale#Var(a:buffer, 'verilog_slang_options') .' '
|
||||
\ . '%t'
|
||||
endfunction
|
||||
@@ -28,6 +30,7 @@ function! ale_linters#verilog#slang#Handle(buffer, lines) abort
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:item = {
|
||||
\ 'filename': l:match[1],
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': (l:match[4] is# 'error') ? 'E' : 'W',
|
||||
\ 'text': s:RemoveUnicodeQuotes(l:match[5]),
|
||||
|
||||
@@ -10,6 +10,7 @@ function! ale_linters#verilog#verilator#GetCommand(buffer) abort
|
||||
" the path to the current file is systematically added to the search path
|
||||
return 'verilator --lint-only -Wall -Wno-DECLFILENAME '
|
||||
\ . '-I%s:h '
|
||||
\ . '-y %s:h '
|
||||
\ . ale#Var(a:buffer, 'verilog_verilator_options') .' '
|
||||
\ . '%t'
|
||||
endfunction
|
||||
|
||||
@@ -12,6 +12,8 @@ let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeL
|
||||
|
||||
let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
|
||||
\ 'build',
|
||||
\ 'build/Debug',
|
||||
\ 'build/Release',
|
||||
\ 'bin',
|
||||
\])
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
||||
" Change tabs to spaces.
|
||||
let l:message = substitute(l:message, "\t", ' ', 'g')
|
||||
" Remove any newlines in the message.
|
||||
let l:message = substitute(l:message, "\n", '', 'g')
|
||||
let l:message = substitute(l:message, "\n", ' ', 'g')
|
||||
" Convert indentation groups into single spaces for better legibility when
|
||||
" put on a single line
|
||||
let l:message = substitute(l:message, ' \+', ' ', 'g')
|
||||
@@ -93,6 +93,7 @@ function! ale#cursor#EchoCursorWarning(...) abort
|
||||
if !empty(l:loc)
|
||||
let l:format = ale#Var(l:buffer, 'echo_msg_format')
|
||||
let l:msg = ale#GetLocItemMessage(l:loc, l:format)
|
||||
|
||||
call ale#cursor#TruncatedEcho(l:msg)
|
||||
let l:info.echoed = 1
|
||||
elseif get(l:info, 'echoed')
|
||||
|
||||
@@ -63,6 +63,12 @@ function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
|
||||
\ . ' -f ' . l:format . ' -'
|
||||
endfunction
|
||||
|
||||
function! s:ShouldIgnoreErrorCode(buffer, code) abort
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
return a:code is# 'SC1101'
|
||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
endfunction
|
||||
|
||||
function! s:HandleShellcheckJSON(buffer, lines) abort
|
||||
try
|
||||
let l:errors = json_decode(a:lines[0])
|
||||
@@ -87,11 +93,17 @@ function! s:HandleShellcheckJSON(buffer, lines) abort
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
let l:code = 'SC' . l:error['code']
|
||||
|
||||
if s:ShouldIgnoreErrorCode(a:buffer, l:code)
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': l:error['line'],
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:error['message'],
|
||||
\ 'code': 'SC' . l:error['code'],
|
||||
\ 'code': l:code,
|
||||
\ 'detail': l:error['message'] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/SC" . l:error['code'],
|
||||
\}
|
||||
|
||||
@@ -107,7 +119,6 @@ function! s:HandleShellcheckJSON(buffer, lines) abort
|
||||
let l:item.end_lnum = l:error['endLine']
|
||||
endif
|
||||
|
||||
|
||||
" If the filename is something like <stdin>, <nofile> or -, then
|
||||
" this is an error for the file we checked.
|
||||
if has_key(l:error, 'file')
|
||||
@@ -135,11 +146,17 @@ function! s:HandleShellcheckGCC(buffer, lines) abort
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
let l:code = l:match[6]
|
||||
|
||||
if s:ShouldIgnoreErrorCode(a:buffer, l:code)
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[6],
|
||||
\ 'code': l:code,
|
||||
\ 'detail': l:match[5] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/" . l:match[6],
|
||||
\}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ function! ale#lsp#response#ReadDiagnostics(diagnostics) abort
|
||||
for l:diagnostic in a:diagnostics
|
||||
let l:severity = get(l:diagnostic, 'severity', 0)
|
||||
let l:loclist_item = {
|
||||
\ 'text': substitute(l:diagnostic.message, '\(\r\n\|\n\|\r\)', ' ', 'g'),
|
||||
\ 'text': l:diagnostic.message,
|
||||
\ 'type': 'E',
|
||||
\ 'lnum': l:diagnostic.range.start.line + 1,
|
||||
\ 'col': l:diagnostic.range.start.character + 1,
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ g:ale_c_always_make
|
||||
c_build_dir_names
|
||||
g:ale_c_build_dir_names
|
||||
Type: |List|
|
||||
Default: `['build', 'bin']`
|
||||
Default: `['build', 'build/Debug', 'build/Release', 'bin']`
|
||||
|
||||
A list of directory names to be used when searching upwards from C files
|
||||
to discover compilation databases with. For directory named `'foo'`, ALE
|
||||
|
||||
@@ -267,6 +267,23 @@ g:ale_ruby_sorbet_enable_watchman
|
||||
to files from outside of vim. Defaults to disable watchman because it
|
||||
requires watchman to be installed separately from sorbet.
|
||||
|
||||
*ale-options.ruby_sorbet_initialization_options*
|
||||
*g:ale_ruby_sorbet_initialization_options*
|
||||
*b:ale_ruby_sorbet_initialization_options*
|
||||
ruby_sorbet_initialization_options
|
||||
g:ale_ruby_sorbet_initialization_options
|
||||
Type: |Dictionary|
|
||||
Default: `{ 'highlightUntyped': v:false }`
|
||||
|
||||
This variable can be changed to modify initialization options provided to
|
||||
the Sorbet language server. By default, a minimal object with defaults is
|
||||
provided to ensure proper LSP initialization.
|
||||
|
||||
Setting this variable to a an empty object will cause sorbet LSP to
|
||||
fail during initialization.
|
||||
|
||||
See https://sorbet.org/docs/lsp#initialize-request for available options.
|
||||
|
||||
|
||||
===============================================================================
|
||||
standardrb *ale-ruby-standardrb*
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC2317
|
||||
DOCKER=${DOCKER:-docker}
|
||||
export DOCKER
|
||||
# Author: w0rp <devw0rp@gmail.com>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Before:
|
||||
runtime ale_linters/shell/shellcheck.vim
|
||||
Save g:ale_warn_about_trailing_whitespace
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
Restore
|
||||
|
||||
Execute(The shellcheck handler should handle basic errors or warnings <0.7.0):
|
||||
AssertEqual
|
||||
@@ -150,3 +150,58 @@ Execute(The shellcheck handler should handle info and style >=0.7.0):
|
||||
\ ]
|
||||
\ }'
|
||||
\ ])
|
||||
|
||||
Execute(shellcheck errors for trailing whitespace should show by default):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 8,
|
||||
\ 'col': 12,
|
||||
\ 'code': 'SC1101',
|
||||
\ 'end_lnum': 8,
|
||||
\ 'type': 'E',
|
||||
\ 'end_col': 11,
|
||||
\ 'text': 'Delete trailing spaces after \ to break line (or use quotes for literal space).',
|
||||
\ 'detail': 'Delete trailing spaces after \ to break line (or use quotes for literal space).' . "\n\nFor more information:\n https://www.shellcheck.net/wiki/" . 'SC1101',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#shellcheck#Handle(bufnr(''), [0, 7, 0], [
|
||||
\ '{
|
||||
\ "comments": [
|
||||
\ {
|
||||
\ "file": "-",
|
||||
\ "line": 8,
|
||||
\ "endLine": 8,
|
||||
\ "column": 12,
|
||||
\ "endColumn": 12,
|
||||
\ "level": "error",
|
||||
\ "code":1101,
|
||||
\ "message":"Delete trailing spaces after \\ to break line (or use quotes for literal space).",
|
||||
\ "fix":null
|
||||
\ }
|
||||
\ ]
|
||||
\ }',
|
||||
\ ])
|
||||
|
||||
Execute(shellcheck errors for trailing whitepsace should be able to be silenced by ale_warn_about_trailing_whitespace):
|
||||
let g:ale_warn_about_trailing_whitespace = 0
|
||||
|
||||
AssertEqual
|
||||
\ [],
|
||||
\ ale#handlers#shellcheck#Handle(bufnr(''), [0, 7, 0], [
|
||||
\ '{
|
||||
\ "comments": [
|
||||
\ {
|
||||
\ "file": "-",
|
||||
\ "line": 8,
|
||||
\ "endLine": 8,
|
||||
\ "column": 12,
|
||||
\ "endColumn": 12,
|
||||
\ "level": "error",
|
||||
\ "code":1101,
|
||||
\ "message":"Delete trailing spaces after \\ to break line (or use quotes for literal space).",
|
||||
\ "fix":null
|
||||
\ }
|
||||
\ ]
|
||||
\ }',
|
||||
\ ])
|
||||
@@ -8,12 +8,14 @@ Execute(The slang handler should parse lines correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'filename' : 'foo.sv',
|
||||
\ 'lnum': 11,
|
||||
\ 'col': 1,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'extra '';'' has no effect [-Wempty-member]',
|
||||
\ },
|
||||
\ {
|
||||
\ 'filename' : 'bar.sv',
|
||||
\ 'lnum': 24,
|
||||
\ 'col': 12,
|
||||
\ 'type': 'E',
|
||||
@@ -22,5 +24,5 @@ Execute(The slang handler should parse lines correctly):
|
||||
\ ],
|
||||
\ ale_linters#verilog#slang#Handle(bufnr(''), [
|
||||
\ 'foo.sv:11:1: warning: extra '';'' has no effect [-Wempty-member]',
|
||||
\ 'foo.sv:24:12: error: cannot mix continuous and procedural assignments to variable ''data_o''',
|
||||
\ 'bar.sv:24:12: error: cannot mix continuous and procedural assignments to variable ''data_o''',
|
||||
\ ])
|
||||
@@ -5,10 +5,10 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default slang command should be correct):
|
||||
AssertLinter 'slang', 'slang -Weverything -I%s:h %t'
|
||||
AssertLinter 'slang', 'slang -Weverything --diag-abs-paths -I%s:h -y%s:h %t'
|
||||
|
||||
Execute(slang options should be configurable):
|
||||
" Additional args for the linter
|
||||
let g:ale_verilog_slang_options = '--define-macro DWIDTH=12'
|
||||
|
||||
AssertLinter 'slang', 'slang -Weverything -I%s:h --define-macro DWIDTH=12 %t'
|
||||
AssertLinter 'slang', 'slang -Weverything --diag-abs-paths -I%s:h -y%s:h --define-macro DWIDTH=12 %t'
|
||||
@@ -6,6 +6,7 @@ Before:
|
||||
let g:ale_ruby_sorbet_executable = 'srb'
|
||||
let g:ale_ruby_sorbet_options = ''
|
||||
let g:ale_ruby_sorbet_enable_watchman = 0
|
||||
let g:ale_ruby_sorbet_initialization_options = { 'highlightUntyped': v:false }
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
@@ -32,3 +33,11 @@ Execute(Setting bundle appends 'exec srb tc'):
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
|
||||
\ . ' exec srb'
|
||||
\ . ' tc --lsp --disable-watchman'
|
||||
|
||||
Execute(Should use predetermined initialization_options by default):
|
||||
AssertLSPOptions { 'highlightUntyped': v:false }
|
||||
|
||||
Execute(Should be able to set custom initialization_options):
|
||||
let g:ale_ruby_sorbet_initialization_options = {'enableTypedFalse': v:true}
|
||||
|
||||
AssertLSPOptions {'enableTypedFalse': v:true}
|
||||
@@ -5,10 +5,10 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default verilator command should be correct):
|
||||
AssertLinter 'verilator', 'verilator --lint-only -Wall -Wno-DECLFILENAME -I%s:h %t'
|
||||
AssertLinter 'verilator', 'verilator --lint-only -Wall -Wno-DECLFILENAME -I%s:h -y %s:h %t'
|
||||
|
||||
Execute(verilator options should be configurable):
|
||||
" Additional args for the linter
|
||||
let g:ale_verilog_verilator_options = '-sv --default-language "1800-2012"'
|
||||
|
||||
AssertLinter 'verilator', 'verilator --lint-only -Wall -Wno-DECLFILENAME -I%s:h -sv --default-language "1800-2012" %t'
|
||||
AssertLinter 'verilator', 'verilator --lint-only -Wall -Wno-DECLFILENAME -I%s:h -y %s:h -sv --default-language "1800-2012" %t'
|
||||
@@ -109,11 +109,11 @@ Execute(ale#lsp#response#ReadDiagnostics() should include sources in detail):
|
||||
\ }
|
||||
\ ])
|
||||
|
||||
Execute(ale#lsp#response#ReadDiagnostics() should keep detail with line breaks but replace with spaces in text):
|
||||
Execute(ale#lsp#response#ReadDiagnostics() should keep line breaks in text):
|
||||
AssertEqual [
|
||||
\ {
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'cannot borrow `cap` as mutable more than once at a time mutable borrow starts here in previous iteration of loop',
|
||||
\ 'text': "cannot borrow `cap` as mutable\r\nmore than once at a time\n\nmutable borrow starts here\rin previous iteration of loop",
|
||||
\ 'detail': "[rustc] cannot borrow `cap` as mutable\r\nmore than once at a time\n\nmutable borrow starts here\rin previous iteration of loop",
|
||||
\ 'lnum': 10,
|
||||
\ 'col': 15,
|
||||
|
||||
@@ -30,7 +30,7 @@ Before:
|
||||
\ 'nr': -1,
|
||||
\ 'type': 'E',
|
||||
\ 'code': 'semi',
|
||||
\ 'text': "Missing semicolon.\r",
|
||||
\ 'text': "Missing\nsemicolon.\r",
|
||||
\ 'detail': "Every statement should end with a semicolon\nsecond line",
|
||||
\ },
|
||||
\ {
|
||||
|
||||
Reference in new issue
Block a user