mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Add support for fortitude (fortran linter) #5004
* add support for fortitude fortran linter * add fortitude fortran linter doc * Add a fortitude linter test file * docs listings are now alphabetically sorted Co-Authored-By: gomfol12 <info@marekb.de>
This commit is contained in:
59
test/handler/test_fortitude_handler.vader
Normal file
59
test/handler/test_fortitude_handler.vader
Normal file
@@ -0,0 +1,59 @@
|
||||
Before:
|
||||
runtime ale_linters/fortran/fortitude.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(Simple fortitude handler run):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 3,
|
||||
\ 'end_lnum': 3,
|
||||
\ 'col': 5,
|
||||
\ 'end_col': 18,
|
||||
\ 'text': '''implicit none'' missing ''external''',
|
||||
\ 'type': 'W',
|
||||
\ 'code': 'C003',
|
||||
\ },
|
||||
\ {
|
||||
\ 'col': 13,
|
||||
\ 'end_col': 14,
|
||||
\ 'end_lnum': 7,
|
||||
\ 'lnum': 7,
|
||||
\ 'text': 'Syntax error',
|
||||
\ 'type': 'E',
|
||||
\ 'code': 'E001',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#fortran#fortitude#Handle(bufnr(''), [
|
||||
\ '[',
|
||||
\ json_encode({
|
||||
\ 'code': 'C003',
|
||||
\ 'end_location': {'column': 18, 'row': 3},
|
||||
\ 'filename': '/home/user/documents/somefortranfile.f90',
|
||||
\ 'fix': {
|
||||
\ 'applicability': 'unsafe',
|
||||
\ 'edits': [
|
||||
\ {
|
||||
\ 'content': ' (type, external)',
|
||||
\ 'end_location': {'column': 18, 'row': 3},
|
||||
\ 'location': {'column': 18, 'row': 3},
|
||||
\ },
|
||||
\ ],
|
||||
\ 'message': 'Add `(external)` to ''implicit none''',
|
||||
\ },
|
||||
\ 'location': {'column': 5, 'row': 3},
|
||||
\ 'message': '''implicit none'' missing ''external'''
|
||||
\ }),
|
||||
\ ',',
|
||||
\ json_encode({
|
||||
\ 'code': 'E001',
|
||||
\ 'end_location': {'column': 14, 'row': 7},
|
||||
\ 'filename': '/home/user/documents/somefortranfile.f90',
|
||||
\ 'fix': v:null,
|
||||
\ 'location': {'column': 13, 'row': 7},
|
||||
\ 'message': 'Syntax error',
|
||||
\ }),
|
||||
\ ']',
|
||||
\ ])
|
||||
16
test/linter/test_fortitude.vader
Normal file
16
test/linter/test_fortitude.vader
Normal file
@@ -0,0 +1,16 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('fortran', 'fortitude')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default fortitude command should be correct):
|
||||
AssertLinter 'fortitude', ale#Escape('fortitude')
|
||||
\ . ' check --output-format json %s'
|
||||
|
||||
Execute(fortitude should be configurable):
|
||||
let b:ale_fortran_fortitude_executable = 'custom-exe'
|
||||
let b:ale_fortran_fortitude_options = '--foobar'
|
||||
|
||||
AssertLinter 'custom-exe', ale#Escape('custom-exe')
|
||||
\ . ' check --output-format json --foobar %s'
|
||||
Reference in New Issue
Block a user