|
1 | 1 | function! phpstan#PHPStanAnalyse(...) |
2 | 2 | let paths = join(a:000, '\ ') |
3 | | - |
4 | 3 | let phpstan_path = phpstan#_resolvePhpstanPath() |
5 | 4 |
|
6 | 5 | let cmd = phpstan_path . ' analyse --errorFormat=raw --no-progress -l' . g:phpstan_analyse_level . ' ' . paths |
7 | | - let result = system(cmd) |
| 6 | + let output = system(cmd) |
8 | 7 |
|
9 | 8 | let list = [] |
10 | | - for line in split(result, "\n") |
| 9 | + for line in split(output, "\n") |
| 10 | + |
| 11 | + " Parse the filename and line number |
11 | 12 | let parts = split(line, ':') |
12 | | - call add(list, { 'filename': parts[0], 'lnum': parts[1], 'text': parts[2] }) |
| 13 | + |
| 14 | + " The reset of the string is the description |
| 15 | + let description = join(parts[2:], ':') |
| 16 | + |
| 17 | + " Add to the quickfix List |
| 18 | + call add(list, { 'filename': parts[0], 'lnum': parts[1], 'text': description }) |
| 19 | + |
13 | 20 | endfor |
14 | 21 |
|
15 | 22 | call setqflist(list) |
16 | | - execute ':cwindow' |
| 23 | + exe 'cwindow' |
17 | 24 | endfun |
18 | 25 |
|
19 | 26 | function! phpstan#_resolvePhpstanPath() |
20 | | - echo g:phpstan_paths |
21 | 27 | for phpstan_path in g:phpstan_paths |
22 | 28 | if filereadable(phpstan_path) |
23 | 29 | return phpstan_path |
24 | 30 | endif |
25 | 31 | endfor |
26 | 32 |
|
27 | 33 | if !executable('phpstan') |
28 | | - throw 'PHPStan doesn't seem to be globally installed or detected locally' |
| 34 | + throw "PHPStan doesn't seem to be globally installed or detected locally" |
29 | 35 | endif |
30 | 36 |
|
31 | 37 | return 'phpstan' |
|
0 commit comments