diff options
-rw-r--r-- | ale_linters/scala/scalastyle.vim | 13 | ||||
-rw-r--r-- | doc/ale-scala.txt | 11 | ||||
-rw-r--r-- | test/handler/test_scalastyle_handler.vader | 21 |
3 files changed, 41 insertions, 4 deletions
diff --git a/ale_linters/scala/scalastyle.vim b/ale_linters/scala/scalastyle.vim index ea56c0e4..f78fd749 100644 --- a/ale_linters/scala/scalastyle.vim +++ b/ale_linters/scala/scalastyle.vim @@ -8,10 +8,21 @@ let g:ale_scalastyle_config_loc = \ get(g:, 'ale_scalastyle_config_loc', '') function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort + " Look for help output from scalastyle first, which indicates that no + " configuration file was found. + for l:line in a:lines[:10] + if l:line =~# '-c, --config' + return [{ + \ 'lnum': 1, + \ 'text': '(See :help ale-scala-scalastyle)' + \ . ' No scalastyle configuration file was found.', + \}] + endif + endfor + " Matches patterns like the following: " " warning file=/home/blurble/Doop.scala message=Missing or badly formed ScalaDoc: Extra @param foobles line=190 - let l:patterns = [ \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\)$', \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\) column=\(\d\+\)$', diff --git a/doc/ale-scala.txt b/doc/ale-scala.txt index 22e684fd..9c9472f6 100644 --- a/doc/ale-scala.txt +++ b/doc/ale-scala.txt @@ -5,6 +5,17 @@ ALE Scala Integration *ale-scala-options* =============================================================================== scalastyle *ale-scala-scalastyle* +`scalastyle` requires a configuration file for a project to run. When no +configuration file can be found, ALE will report a problem saying that a +configuration file is required at line 1. + +To disable `scalastyle` globally, use |g:ale_linters| like so: > + let g:ale_linters = {'scala': ['scalac']} " Enable only scalac instead +< + +See |g:ale_linters| for more information on disabling linters. + + g:ale_scalastyle_config_loc *g:ale_scalastyle_config_loc* Type: |String| diff --git a/test/handler/test_scalastyle_handler.vader b/test/handler/test_scalastyle_handler.vader index b03d18e7..32da79c0 100644 --- a/test/handler/test_scalastyle_handler.vader +++ b/test/handler/test_scalastyle_handler.vader @@ -1,6 +1,10 @@ -Execute(The scalastyle handler should parse lines correctly): +Before: runtime! ale_linters/scala/scalastyle.vim +After: + call ale#linter#Reset() + +Execute(The scalastyle handler should parse lines correctly): AssertEqual \ [ \ { @@ -34,5 +38,16 @@ Execute(The scalastyle handler should parse lines correctly): \ 'Finished in 934 ms', \ ]) -After: - call ale#linter#Reset() +Execute(The scalastyle linter should complain when there is no configuration file): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'text': '(See :help ale-scala-scalastyle) No scalastyle configuration file was found.', + \ }, + \ ], + \ ale_linters#scala#scalastyle#Handle(347, [ + \ 'scalastyle 1.0.0', + \ 'Usage: scalastyle [options] <source directory>', + \ ' -c, --config FILE configuration file (required)', + \ ]) |