]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/po/msgfmt.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / ale_linters / po / msgfmt.vim
1 " Author: Cian Butler https://github.com/butlerx
2 " Description: msgfmt for PO files
3
4 function! ale_linters#po#msgfmt#Handle(buffer, lines) abort
5     let l:results = ale#handlers#unix#HandleAsWarning(a:buffer, a:lines)
6     let l:index = 0
7
8     for l:item in l:results
9         if l:index > 0 && l:item.text =~? 'this is the location of the first definition'
10             let l:last_item = l:results[l:index - 1]
11
12             if l:last_item.text =~? 'duplicate message definition'
13                 let l:last_item.text = 'duplicate of message at line ' . l:item.lnum
14                 let l:item.text = 'first location of duplicate of message at line ' . l:last_item.lnum
15             endif
16         endif
17
18         let l:index += 1
19     endfor
20
21     return l:results
22 endfunction
23
24 call ale#linter#Define('po', {
25 \   'name': 'msgfmt',
26 \   'executable': 'msgfmt',
27 \   'output_stream': 'stderr',
28 \   'command': 'msgfmt --statistics --output-file=- %t',
29 \   'callback': 'ale_linters#po#msgfmt#Handle',
30 \})