Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit d751d17

Browse files
committed
PC-Lint: cleanup.
1 parent 3476e4f commit d751d17

3 files changed

Lines changed: 41 additions & 29 deletions

File tree

plugin/syntastic.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if has('reltime')
1919
lockvar! g:syntastic_start
2020
endif
2121

22-
let g:syntastic_version = '3.5.0-17'
22+
let g:syntastic_version = '3.5.0-21'
2323
lockvar g:syntastic_version
2424

2525
" Sanity checks {{{1

syntax_checkers/c/pc_lint.vim

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
" See http://sam.zoy.org/wtfpl/COPYING for more details.
1010
"
1111
"============================================================================
12-
"
13-
"" To use a lint option file, rename it to options.lnt and put it in
14-
"" the same directory as the file you're linting, or any parent directory
15-
"" of that file. Syntastic will use the first options.lnt file it finds.
1612

1713
if exists("g:loaded_syntastic_c_pc_lint_checker")
1814
finish
@@ -26,40 +22,30 @@ if !exists('g:syntastic_pc_lint_config_file')
2622
let g:syntastic_pc_lint_config_file = 'options.lnt'
2723
endif
2824

29-
" stolen from c.vim in syntastic
30-
function! s:getOptionFile(file)
31-
" search in the current file's directory upwards
32-
let config = findfile(a:file, '.;')
33-
if config == '' || !filereadable(config)
34-
return ''
35-
endif
36-
" convert filename into absolute path filename
37-
return fnamemodify(config, ':p')
38-
endfunction
39-
4025
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
26+
let config = findfile(g:syntastic_pc_lint_config_file, '.;')
4127

42-
" -hF1 always shows the filename, tries to make message 1 line
43-
" -width(0,0) makes sure there's no line breaks
28+
" -hF1 - show filename, try to make message 1 line
29+
" -width(0,0) - make sure there are no line breaks
4430
let makeprg = self.makeprgBuild({
45-
\ "args": syntastic#util#shescape(
46-
\ s:getOptionFile(g:syntastic_pc_lint_config_file)) . ' -hF1 ' .
47-
\ syntastic#util#shescape('-width(0,0)')})
31+
\ 'args': (filereadable(config) ? syntastic#util#shescape(fnamemodify(config, ':p')) : ''),
32+
\ 'args_after': ['-hF1', '-width(0,0)'] })
4833

4934
let errorformat =
50-
\ '%f %l %trror %n: %m,' .
51-
\ '%f %l %tarning %n: %m,' .
52-
\ '%W%f %l Info %n: %m'
35+
\ '%E%f %l Error %n: %m,' .
36+
\ '%W%f %l Warning %n: %m,' .
37+
\ '%W%f %l Info %n: %m,' .
38+
\ '%-G%.%#'
5339

5440
return SyntasticMake({
55-
\ 'makeprg': makeprg,
56-
\ 'errorformat': errorformat })
41+
\ 'makeprg': makeprg,
42+
\ 'errorformat': errorformat })
5743
endfunction
5844

5945
call g:SyntasticRegistry.CreateAndRegisterChecker({
60-
\ 'filetype': 'c',
61-
\ 'name': 'pc_lint',
62-
\ 'exec': 'lint-nt'})
46+
\ 'filetype': 'c',
47+
\ 'name': 'pc_lint',
48+
\ 'exec': 'lint-nt'})
6349

6450
let &cpo = s:save_cpo
6551
unlet s:save_cpo

syntax_checkers/cpp/pc_lint.vim

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"============================================================================
2+
"File: pc_lint.vim
3+
"Description: Syntax checking plugin for syntastic.vim
4+
"Maintainer: Steve Bragg <steve at empresseffects dot com>
5+
"License: This program is free software. It comes without any warranty,
6+
" to the extent permitted by applicable law. You can redistribute
7+
" it and/or modify it under the terms of the Do What The Fuck You
8+
" Want To Public License, Version 2, as published by Sam Hocevar.
9+
" See http://sam.zoy.org/wtfpl/COPYING for more details.
10+
"
11+
"============================================================================
12+
13+
if exists("g:loaded_syntastic_cpp_pc_lint_checker")
14+
finish
15+
endif
16+
let g:loaded_syntastic_cpp_pc_lint_checker = 1
17+
18+
runtime! syntax_checkers/c/*.vim
19+
20+
call g:SyntasticRegistry.CreateAndRegisterChecker({
21+
\ 'filetype': 'cpp',
22+
\ 'name': 'pc_lint',
23+
\ 'exec': 'lint-nt',
24+
\ 'redirect': 'c/pc_lint'})
25+
26+
" vim: set et sts=4 sw=4:

0 commit comments

Comments
 (0)