mirror of https://github.com/dense-analysis/ale
Fix 3838 - deprecate datanalyzer (#3839)
Co-authored-by: Horacio Sanson <horacio@allm.inc>
This commit is contained in:
parent
5a5029b73d
commit
76bd059371
|
@ -1,36 +0,0 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Check Dart files with dartanalyzer
|
||||
|
||||
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[2],
|
||||
\ 'lnum': str2nr(l:match[4]),
|
||||
\ 'col': str2nr(l:match[5]),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dartanalyzer',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_dartanalyzer_executable')},
|
||||
\ 'command': function('ale_linters#dart#dartanalyzer#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -87,39 +87,6 @@ g:ale_dart_format_options *g:ale_dart_format_options*
|
|||
This variable can be set to pass additional options to the dart format fixer.
|
||||
|
||||
|
||||
|
||||
===============================================================================
|
||||
dartanalyzer *ale-dart-dartanalyzer*
|
||||
|
||||
Installation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Install Dart via whatever means. `dartanalyzer` will be included in the SDK.
|
||||
|
||||
You can add the SDK to `$PATH`, as described here:
|
||||
https://www.dartlang.org/tools/sdk
|
||||
|
||||
If you have installed Dart on Linux, you can also try the following: >
|
||||
" Set the executable path for dartanalyzer to the absolute path to it.
|
||||
let g:ale_dart_dartanalyzer_executable = '/usr/lib/dart/bin/dartanalyzer'
|
||||
<
|
||||
... or similarly for wherever your Dart SDK lives. This should work without
|
||||
having to modify `$PATH`.
|
||||
|
||||
ALE can only check for problems with `dartanalyzer` with the file on disk.
|
||||
See |ale-lint-file-linters|
|
||||
|
||||
Options
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
g:ale_dart_dartanalyzer_executable *g:ale_dart_dartanalyzer_executable*
|
||||
*b:ale_dart_dartanalyzer_executable*
|
||||
Type: |String|
|
||||
Default: `'dartanalyzer'`
|
||||
|
||||
This variable can be set to change the path to dartanalyzer.
|
||||
|
||||
|
||||
===============================================================================
|
||||
dartfmt *ale-dart-dartfmt*
|
||||
|
||||
|
|
|
@ -136,7 +136,6 @@ Notes:
|
|||
* `analysis_server`
|
||||
* `dart-analyze`!!
|
||||
* `dart-format`!!
|
||||
* `dartanalyzer`!!
|
||||
* `dartfmt`!!
|
||||
* `language_server`
|
||||
* desktop
|
||||
|
|
|
@ -2785,7 +2785,6 @@ documented in additional help files.
|
|||
analysis_server.......................|ale-dart-analysis_server|
|
||||
dart-analyze..........................|ale-dart-analyze|
|
||||
dart-format...........................|ale-dart-format|
|
||||
dartanalyzer..........................|ale-dart-dartanalyzer|
|
||||
dartfmt...............................|ale-dart-dartfmt|
|
||||
desktop.................................|ale-desktop-options|
|
||||
desktop-file-validate.................|ale-desktop-desktop-file-validate|
|
||||
|
|
|
@ -144,9 +144,8 @@ formatting.
|
|||
* Dart
|
||||
* [analysis_server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server)
|
||||
* [dart-analyze](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk:
|
||||
* [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk:
|
||||
* [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk:
|
||||
* [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) :floppy_disk:
|
||||
* [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt)
|
||||
* [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt)
|
||||
* [language_server](https://github.com/natebosch/dart_language_server)
|
||||
* desktop
|
||||
* [desktop-file-validate](https://www.freedesktop.org/wiki/Software/desktop-file-utils/)
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
Before:
|
||||
runtime ale_linters/dart/dartanalyzer.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(Basic problems should be parsed correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'expected_token: Expected to find ''}''',
|
||||
\ 'lnum': 5,
|
||||
\ 'col': 1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'invalid_assignment: A value of type ''String'' can''t be assigned to a variable of type ''int''',
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 16,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#dart#dartanalyzer#Handle(bufnr(''), [
|
||||
\ 'Analyzing main.dart...',
|
||||
\ ' error • Expected to find ''}'' at main.dart:5:1 • expected_token',
|
||||
\ ' warning • A value of type ''String'' can''t be assigned to a variable of type ''int'' at main.dart:2:16 • invalid_assignment',
|
||||
\ '1 error and 1 warning found.',
|
||||
\ ])
|
|
@ -1,20 +0,0 @@
|
|||
Before:
|
||||
call ale#assert#SetUpLinterTest('dart', 'dartanalyzer')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command and executable should be correct):
|
||||
AssertLinter 'dartanalyzer', ale#Escape('dartanalyzer') . ' %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_dart_dartanalyzer_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
||||
|
||||
Execute(The .packages file should be set if detected):
|
||||
call ale#test#SetFilename('../test-files/dart/foo')
|
||||
|
||||
AssertLinter 'dartanalyzer', ale#Escape('dartanalyzer')
|
||||
\ . ' --packages ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/dart/.packages'))
|
||||
\ . ' %s'
|
Loading…
Reference in New Issue