mirror of
https://github.com/dense-analysis/ale.git
synced 2026-04-13 19:29:33 +08:00
Add support for LilyPond syntax (#5117)
* Add support for LilyPond syntax See: https://lilypond.org/ * Fix alpha order of LilyPond * Add support for custom executable and options to lilypond linter Enhances the lilypond linter with configurable options: - Add g:ale_lilypond_lilypond_executable for custom lilypond binary path - Add g:ale_lilypond_lilypond_options for additional command-line flags - Refactor linter to use GetCommand() function for dynamic command building - Add linter tests covering configuration scenarios - Update documentation with usage examples and proper formatting --------- Co-authored-by: samb0t <sambottoni@gmail.com>
This commit is contained in:
49
test/handler/test_lilypond.vader
Normal file
49
test/handler/test_lilypond.vader
Normal file
@@ -0,0 +1,49 @@
|
||||
Before:
|
||||
runtime ale_linters/lilypond/lilypond.vim
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The lilypond handler should parse a single error correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 5,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'syntax error, unexpected NOT_A_TOKEN',
|
||||
\ }
|
||||
\ ],
|
||||
\ ale_linters#lilypond#lilypond#Handle(0, [
|
||||
\ 'test.ly:2:5: error: syntax error, unexpected NOT_A_TOKEN'
|
||||
\ ])
|
||||
|
||||
Execute(The lilypond handler should parse warnings and errors):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 1,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'deprecated syntax',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 5,
|
||||
\ 'col': 12,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'unknown symbol',
|
||||
\ }
|
||||
\ ],
|
||||
\ ale_linters#lilypond#lilypond#Handle(0, [
|
||||
\ 'test.ly:3:1: warning: deprecated syntax',
|
||||
\ 'test.ly:5:12: error: unknown symbol'
|
||||
\ ])
|
||||
|
||||
Execute(The lilypond handler should ignore non-matching lines):
|
||||
AssertEqual
|
||||
\ [],
|
||||
\ ale_linters#lilypond#lilypond#Handle(0, [
|
||||
\ 'This is some unrelated output',
|
||||
\ 'Another line without structure'
|
||||
\ ])
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
35
test/linter/test_lilypond.vader
Normal file
35
test/linter/test_lilypond.vader
Normal file
@@ -0,0 +1,35 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('lilypond', 'lilypond')
|
||||
call ale#test#SetFilename('test.ly')
|
||||
|
||||
let g:ale_lilypond_lilypond_executable = 'lilypond'
|
||||
let g:ale_lilypond_lilypond_options = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should default to lilypond):
|
||||
AssertLinter 'lilypond',
|
||||
\ ale#Escape('lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp %t 2>&1'
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_lilypond_lilypond_executable = 'bin/lilypond'
|
||||
|
||||
AssertLinter 'bin/lilypond',
|
||||
\ ale#Escape('bin/lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp %t 2>&1'
|
||||
|
||||
Execute(Should be able to set custom options):
|
||||
let g:ale_lilypond_lilypond_options = '--include=/path/to/includes'
|
||||
|
||||
AssertLinter 'lilypond',
|
||||
\ ale#Escape('lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
|
||||
\ . ' --include=/path/to/includes %t 2>&1'
|
||||
|
||||
Execute(Should be able to set both custom executable and options):
|
||||
let g:ale_lilypond_lilypond_executable = '/usr/local/bin/lilypond'
|
||||
let g:ale_lilypond_lilypond_options = '--include=/custom/path -dlog-file=/tmp/lily.log'
|
||||
|
||||
AssertLinter '/usr/local/bin/lilypond',
|
||||
\ ale#Escape('/usr/local/bin/lilypond') . ' --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
|
||||
\ . ' --include=/custom/path -dlog-file=/tmp/lily.log %t 2>&1'
|
||||
|
||||
Reference in New Issue
Block a user