mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
Copy all loclist items returned from handlers, and set up defaults for convenience
This commit is contained in:
@@ -6,20 +6,16 @@ Execute(The credo handler should parse lines correctly):
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 1,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 4,
|
||||
\ 'text': 'There is no whitespace around parentheses/brackets most of the time, but here there is.',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 26,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': 'If/else blocks should not have a negated condition in `if`.',
|
||||
\ 'type': 'W',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#elixir#credo#Handle(347, [
|
||||
|
||||
@@ -6,29 +6,23 @@ Execute(The eslint handler should parse lines correctly):
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 47,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 14,
|
||||
\ 'text': 'Missing trailing comma. [Warning/comma-dangle]',
|
||||
\ 'type': 'W',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 56,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 41,
|
||||
\ 'text': 'Missing semicolon. [Error/semi]',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 13,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'Parsing error: Unexpected token',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#javascript#eslint#Handle(347, [
|
||||
|
||||
@@ -114,7 +114,6 @@ Execute(The flow handler should process errors correctly.):
|
||||
\ {
|
||||
\ 'lnum': 417,
|
||||
\ 'bufnr': 347,
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'col': 10,
|
||||
\ 'text': 'number: This type is incompatible with the expected return type of array type',
|
||||
@@ -122,7 +121,6 @@ Execute(The flow handler should process errors correctly.):
|
||||
\ {
|
||||
\ 'lnum': 419,
|
||||
\ 'bufnr': 347,
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'W',
|
||||
\ 'col': 3,
|
||||
\ 'text': 'unreachable code:',
|
||||
|
||||
@@ -6,20 +6,16 @@ Execute(The fortran handler should parse lines from GCC 4.1.2 correctly):
|
||||
\ {
|
||||
\ 'bufnr': 357,
|
||||
\ 'lnum': 4,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 357,
|
||||
\ 'lnum': 3,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#fortran#gcc#Handle(357, [
|
||||
@@ -47,20 +43,16 @@ Execute(The fortran handler should parse lines from GCC 4.9.3 correctly):
|
||||
\ {
|
||||
\ 'bufnr': 357,
|
||||
\ 'lnum': 3,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 12,
|
||||
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 357,
|
||||
\ 'lnum': 4,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 12,
|
||||
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#fortran#gcc#Handle(357, [
|
||||
@@ -89,20 +81,16 @@ Execute(The fortran handler should parse lines from GCC 6.3.1 correctly):
|
||||
\ {
|
||||
\ 'bufnr': 337,
|
||||
\ 'lnum': 3,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 12,
|
||||
\ 'text': "Symbol ‘a’ at (1) has no IMPLICIT type",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 337,
|
||||
\ 'lnum': 4,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 12,
|
||||
\ 'text': "Symbol ‘b’ at (1) has no IMPLICIT type",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#fortran#gcc#Handle(337, [
|
||||
|
||||
130
test/test_loclist_corrections.vader
Normal file
130
test/test_loclist_corrections.vader
Normal file
@@ -0,0 +1,130 @@
|
||||
Given foo (Some file with lines to count):
|
||||
foo12345678
|
||||
bar12345678
|
||||
baz12345678
|
||||
four12345678
|
||||
five12345678
|
||||
six12345678
|
||||
seven12345678
|
||||
eight12345678
|
||||
nine12345678
|
||||
ten12345678
|
||||
|
||||
Execute(FixLocList should set all the default values correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'text': 'a',
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 0,
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\ {
|
||||
\ 'text': 'b',
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 0,
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ {'name': 'foobar'},
|
||||
\ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}],
|
||||
\ )
|
||||
|
||||
Execute(FixLocList should use the values we supply):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'text': 'a',
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 4,
|
||||
\ 'bufnr': 10000,
|
||||
\ 'vcol': 1,
|
||||
\ 'type': 'W',
|
||||
\ 'nr': 42,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ {'name': 'foobar'},
|
||||
\ [{
|
||||
\ 'text': 'a',
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 4,
|
||||
\ 'bufnr': 10000,
|
||||
\ 'vcol': 1,
|
||||
\ 'type': 'W',
|
||||
\ 'nr': 42,
|
||||
\ }],
|
||||
\ )
|
||||
|
||||
Execute(FixLocList should set items with lines beyond the end to the last line):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'text': 'a',
|
||||
\ 'lnum': 10,
|
||||
\ 'col': 0,
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ {'name': 'foobar'},
|
||||
\ [{'text': 'a', 'lnum': 11}],
|
||||
\ )
|
||||
|
||||
Execute(FixLocList should move line 0 to line 1):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'text': 'a',
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 0,
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ {'name': 'foobar'},
|
||||
\ [{'text': 'a', 'lnum': 0}],
|
||||
\ )
|
||||
|
||||
Execute(FixLocList should convert line and column numbers correctly):
|
||||
" The numbers should be 10, not 8 as octals.
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'text': 'a',
|
||||
\ 'lnum': 10,
|
||||
\ 'col': 10,
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'vcol': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ {'name': 'foobar'},
|
||||
\ [{'text': 'a', 'lnum': '010', 'col': '010'}],
|
||||
\ )
|
||||
@@ -6,20 +6,16 @@ Execute(The mypy handler should parse lines correctly):
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 4,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "No library stub file for module 'django.db'",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 40,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 5,
|
||||
\ 'text': "Some other problem",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#python#mypy#Handle(347, [
|
||||
|
||||
@@ -6,47 +6,37 @@ Execute(The php handler should parse lines correctly):
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 47,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "syntax error, unexpected ';', expecting ']'",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 56,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "syntax error, unexpected '/', expecting function (T_FUNCTION) or const (T_CONST)",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 13,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "syntax error, unexpected ')'",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 5,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "Invalid numeric literal",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 21,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': "syntax error, unexpected end of file",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#php#php#Handle(347, [
|
||||
|
||||
@@ -6,29 +6,23 @@ Execute(The standard handler should parse lines correctly):
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 47,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 14,
|
||||
\ 'text': 'Expected indentation of 2 spaces but found 4.',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 56,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 41,
|
||||
\ 'text': 'Strings must use singlequote.',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 13,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'Parsing error: Unexpected token',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#javascript#standard#Handle(347, [
|
||||
|
||||
@@ -6,20 +6,16 @@ Execute(The typecheck handler should parse lines correctly):
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 16,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 7,
|
||||
\ 'text': "Type 'A' is not assignable to type 'B'",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 347,
|
||||
\ 'lnum': 7,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 41,
|
||||
\ 'text': "Property 'a' does not exist on type 'A'",
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#typescript#typecheck#Handle(347, [
|
||||
|
||||
Reference in New Issue
Block a user