From 4d9a8338e1ce1b17fdaef7412ac56835b8f27317 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 23 May 2013 11:50:26 +0300 Subject: [PATCH 01/17] Minor optimisation related to syntastic_ignore_files. --- plugin/syntastic.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 41c4a7d2..8fa4745d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -354,7 +354,11 @@ function! SyntasticMake(options) endif " Apply ignore patterns - call filter(errors, '!s:IgnoreFile(bufname(str2nr(v:val["bufnr"])))') + let ignore = {} + for buf in syntastic#util#unique(map(copy(errors), 'v:val["bufnr"]')) + let ignore[buf] = s:IgnoreFile(bufname(str2nr(buf))) + endfor + call filter(errors, '!ignore[v:val["bufnr"]]') " Add subtype info if present. if has_key(a:options, 'subtype') From d6c047a0121493d0cbad350fd8309175a37be7ac Mon Sep 17 00:00:00 2001 From: Garrison Jensen Date: Thu, 23 May 2013 18:04:13 -0600 Subject: [PATCH 02/17] Change 'call' to 'execute' According to https://github.com/tpope/vim-pathogen --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index d46b57d4..7a28bd03 100644 --- a/README.markdown +++ b/README.markdown @@ -66,7 +66,7 @@ and the directories it needs: Next you *need to add this* to your ~/.vimrc: - call pathogen#infect() + execute pathogen#infect() Step 2: Install syntastic as a pathogen bundle ---------------------------------------------- From b4e0bdfe12da739a5f1abee1ff7717e02c64a376 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 26 May 2013 17:47:52 +0300 Subject: [PATCH 03/17] Coffee checker: "--lint" is now deprecated. --- syntax_checkers/coffee/coffee.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 039db208..aa965bb6 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -21,7 +21,6 @@ endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', - \ 'args': '--lint', \ 'subchecker': 'coffee' }) let errorformat = \ '%E%f:%l:%c: %trror: %m,' . From d205c97e95fe4d24e3179c0afdee8c04f7bccf86 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 27 May 2013 09:23:09 +0300 Subject: [PATCH 04/17] Clear loclist if there are no errors. Fixes #650. --- plugin/syntastic.vim | 4 ++-- plugin/syntastic/loclist.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 8fa4745d..a03a5aed 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -133,9 +133,9 @@ function! s:UpdateErrors(auto_invoked, ...) let loclist = g:SyntasticLoclist.current() call s:notifiers.refresh(loclist) - if (g:syntastic_always_populate_loc_list || g:syntastic_auto_jump) && loclist.hasErrorsOrWarningsToDisplay() + if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call setloclist(0, loclist.filteredRaw()) - if g:syntastic_auto_jump + if g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() silent! lrewind endif endif diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 1b9b5391..2dd0bd5a 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -133,8 +133,8 @@ endfunction "display the cached errors for this buf in the location list function! g:SyntasticLoclist.show() + call setloclist(0, self.filteredRaw()) if self.hasErrorsOrWarningsToDisplay() - call setloclist(0, self.filteredRaw()) let num = winnr() exec "lopen " . g:syntastic_loc_list_height if num != winnr() From 729e2e08fb5f471e388216119478d618a7f96515 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 27 May 2013 10:20:44 +0300 Subject: [PATCH 05/17] Add a note about syntastic_always_populate_loc_list. Formatting. --- README.markdown | 64 +++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/README.markdown b/README.markdown index 7a28bd03..b1d83bcc 100644 --- a/README.markdown +++ b/README.markdown @@ -31,8 +31,7 @@ gentoo_metadata, go, haml, haskell, haxe, html, java, javascript, json, less, li nasm, objc, ocaml, perl, php, puppet, python, rst, ruby, rust, sass/scss, scala, sh, slim, tcl, tex, twig, typescript, vala, vhdl, xhtml, xml, xslt, yaml, z80, zpt, zsh -Screenshot ----------- +## Screenshot Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods @@ -47,14 +46,12 @@ enabled. 5. Hover the mouse over a line containing an error and the error message is displayed as a balloon. 6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted. -Installation ------------- +## Installation Installing syntastic is easy but first you need to have the pathogen plugin installed. If you already have pathogen working then skip Step 1 and go to Step 2. -Step 1: Install pathogen.vim ----------------------------- +### Step 1: Install pathogen.vim First I'll show you how to install tpope's [pathogen.vim](https://github.com/tpope/vim-pathogen) so that it's easy to install syntastic. Do this in your Terminal so that you get the pathogen.vim file @@ -68,8 +65,7 @@ Next you *need to add this* to your ~/.vimrc: execute pathogen#infect() -Step 2: Install syntastic as a pathogen bundle ----------------------------------------------- +### Step 2: Install syntastic as a pathogen bundle You now have pathogen installed and can put syntastic into ~/.vim/bundle like this: @@ -90,22 +86,20 @@ step 1 and make sure you did the following: 4. Have permissions to access all of these directories. -Google group ------------- +## Google group To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic). -FAQ ---- +## FAQ -__Q. I installed syntastic but it isn't reporting any errors ...__ +### Q. I installed syntastic but it isn't reporting any errors... A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. -__Q. Recently some of my syntax checker options have stopped working...__ +### Q. Recently some of my syntax checker options have stopped working... A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. @@ -113,49 +107,61 @@ e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntasti See `:help syntastic-checker-options` for more information. -__Q. How can I pass additional arguments to a checker?__ +### Q. I run a chacker and the location list is not updated... + +A. By default, the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc: +```vim +let g:syntastic_always_populate_loc_list=1 +``` + +### Q. How can I pass additional arguments to a checker? A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: - -`syntastic_[filetype]_[subchecker]_args` +```vim +syntastic_[filetype]_[subchecker]_args +``` So, If you wanted to pass "--my --args --here" to the ruby mri checker you would add this line to your vimrc: - -`let g:syntastic_ruby_mri_args="--my --args --here"` +```vim +let g:syntastic_ruby_mri_args="--my --args --here" +``` See `:help syntastic-checker-options` for more information. -__Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__ +### Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use? A. Stick a line like this in your vimrc: - -`let g:syntastic__checkers=['']` +```vim +let g:syntastic__checkers=[''] +``` To see the list of checkers for your filetype, look in `syntax_checkers//`. e.g. Python has the following checkers: `flake8`, `pyflakes`, `pylint` and a native `python` checker. To tell syntastic to use `pylint`, you would use this setting: - -`let g:syntastic_python_checkers=['pylint']` +```vim +let g:syntastic_python_checkers=['pylint'] +``` Some filetypes, like PHP, have style checkers as well as syntax checkers. These can be chained together like this: - -`let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']` +```vim +let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd'] +``` This is telling syntastic to run the `php` checker first, and if no errors are found, run `phpcs`, and then `phpmd`. -__Q. How can I jump between the different errors without using the location list at the bottom of the window?__ +### Q. How can I jump between the different errors without using the location list at the bottom of the window? A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`. If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired) - which provides such mappings (among other things). -__Q. A syntax checker is giving me unwanted/strange style tips?__ +### Q. A syntax checker is giving me unwanted/strange style tips? A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the syntax checker integration file (e.g. `syntax_checkers/php.vim`) to see what options are available. -__Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ +### Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it? A. There is no safe way to handle that situation automatically, but you can work around it: From cc1b898c788b25cb85f166bf50c17336765a0bdb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 27 May 2013 10:43:11 +0300 Subject: [PATCH 06/17] Minor update to the docs. --- README.markdown | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.markdown b/README.markdown index b1d83bcc..e2d109a0 100644 --- a/README.markdown +++ b/README.markdown @@ -25,11 +25,14 @@ demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them. -At the time of this writing, syntax checking plugins exist for ada, applescript, c, co, -coffee, coq, cpp, cs, css, cucumber, cuda, d, dart, docbk, elixir, erlang, eruby, fortran, -gentoo_metadata, go, haml, haskell, haxe, html, java, javascript, json, less, lisp, lua, matlab, -nasm, objc, ocaml, perl, php, puppet, python, rst, ruby, rust, sass/scss, scala, sh, slim, tcl, tex, -twig, typescript, vala, vhdl, xhtml, xml, xslt, yaml, z80, zpt, zsh +At the time of this writing, syntax checking plugins exist for Ada, +AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, +Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, Gentoo +metadata, Go, Haml, Haskell, Haxe, HTML, Java, JavaScript, JSON, LESS, +LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, OCaml, +Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Ruby, Rust, +SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, VHDL, xHtml, +XML, XSLT, YAML, z80, Zope page templates, zsh. ## Screenshot @@ -155,11 +158,11 @@ This is telling syntastic to run the `php` checker first, and if no errors are f A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`. -If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired) - which provides such mappings (among other things). +If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired), which provides such mappings (among other things). ### Q. A syntax checker is giving me unwanted/strange style tips? -A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the syntax checker integration file (e.g. `syntax_checkers/php.vim`) to see what options are available. +A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers) to see what options are available. ### Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it? From 6be98fe1101f868b1bbadea58c1a725051aec4b1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 28 May 2013 10:26:30 +0300 Subject: [PATCH 07/17] Formatting, again. --- README.markdown | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.markdown b/README.markdown index e2d109a0..1daa1696 100644 --- a/README.markdown +++ b/README.markdown @@ -96,13 +96,13 @@ To get information or make suggestions check out the [google group](https://grou ## FAQ -### Q. I installed syntastic but it isn't reporting any errors... +__Q. I installed syntastic but it isn't reporting any errors...__ A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. -### Q. Recently some of my syntax checker options have stopped working... +__Q. Recently some of my syntax checker options have stopped working...__ A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. @@ -110,14 +110,14 @@ e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntasti See `:help syntastic-checker-options` for more information. -### Q. I run a chacker and the location list is not updated... +__Q. I run a chacker and the location list is not updated...__ A. By default, the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc: ```vim let g:syntastic_always_populate_loc_list=1 ``` -### Q. How can I pass additional arguments to a checker? +__Q. How can I pass additional arguments to a checker?__ A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: ```vim @@ -131,7 +131,7 @@ let g:syntastic_ruby_mri_args="--my --args --here" See `:help syntastic-checker-options` for more information. -### Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use? +__Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__ A. Stick a line like this in your vimrc: ```vim @@ -154,17 +154,17 @@ let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd'] This is telling syntastic to run the `php` checker first, and if no errors are found, run `phpcs`, and then `phpmd`. -### Q. How can I jump between the different errors without using the location list at the bottom of the window? +__Q. How can I jump between the different errors without using the location list at the bottom of the window?__ A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`. If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired), which provides such mappings (among other things). -### Q. A syntax checker is giving me unwanted/strange style tips? +__Q. A syntax checker is giving me unwanted/strange style tips?__ A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers) to see what options are available. -### Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it? +__Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ A. There is no safe way to handle that situation automatically, but you can work around it: From dd6e1c703b1356e2269353d84a2721d128f15f52 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 09:55:42 +0300 Subject: [PATCH 08/17] Relax parsing of version strings. --- autoload/syntastic/util.vim | 18 ++++++++++-------- syntax_checkers/javascript/jshint.vim | 3 +-- syntax_checkers/puppet/puppetlint.vim | 9 ++------- syntax_checkers/slim/slimrb.vim | 11 ++++------- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index e68f6c95..4e777b3d 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -43,18 +43,20 @@ function! syntastic#util#parseShebang() return {'exe': '', 'args': []} endfunction -" Verify that the 'installed' version is at the 'required' version, if not -" better. +" Run 'command' in a shell and parse output as a version string. +" Returns an array of version components. +function! syntastic#util#parseVersion(command) + return split(matchstr( system(a:command), '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.') +endfunction + +" Verify that the 'installed' version is at least the 'required' version. " -" 'installed' and 'required' must be arrays. Only the -" first three elements (major, minor, patch) are looked at. -" -" Either array may be less than three elements. The "missing" elements -" will be assumed to be '0' for the purposes of checking. +" 'installed' and 'required' must be arrays. If they have different lengths, +" the "missing" elements will be assumed to be 0 for the purposes of checking. " " See http://semver.org for info about version numbers. function! syntastic#util#versionIsAtLeast(installed, required) - for index in [0,1,2] + for index in range(max([len(a:installed), len(a:required)])) if len(a:installed) <= index let installed_element = 0 else diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 0101a701..9b10c180 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -36,8 +36,7 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() endfunction function s:JshintNew() - let ver = matchlist(system('jshint --version'), '^\D*\(\d\+\)\.\(\d\+\)') - return (ver[1] > 1 || (ver[1] == 1 && ver[2] >= 1)) + return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('jshint --version'), [1, 1]) endfunction function s:Args() diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 72173859..32ccd901 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -33,19 +33,14 @@ endif function! s:PuppetVersion() if !exists("s:puppet_version") - let output = system("puppet --version 2>/dev/null") - let output = substitute(output, '\n$', '', '') - let s:puppet_version = split(output, '\.') + let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>/dev/null") endif return s:puppet_version endfunction function! s:PuppetLintVersion() if !exists("s:puppet_lint_version") - let output = system("puppet-lint --version 2>/dev/null") - let output = substitute(output, '\n$', '', '') - let output = substitute(output, '^puppet-lint ', '', 'i') - let s:puppet_lint_version = split(output, '\.') + let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>/dev/null") endif return s:puppet_lint_version endfunction diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index d9c5849b..34220337 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -21,19 +21,16 @@ endfunction function! s:SlimrbVersion() if !exists('s:slimrb_version') - let output = system("slimrb --version 2>/dev/null") - let output = substitute(output, '\n$', '', '') - let output = substitute(output, '^slim ', '', 'i') - let s:slimrb_version = split(output, '\.') + let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>/dev/null') end return s:slimrb_version endfunction function! SyntaxCheckers_slim_slimrb_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'slimrb', - \ 'args': '-c', - \ 'subchecker': 'slimrb' }) + \ 'exe': 'slimrb', + \ 'args': '-c', + \ 'subchecker': 'slimrb' }) if syntastic#util#versionIsAtLeast(s:SlimrbVersion(), [1,3,1]) let errorformat = \ '%C\ %#%f\, Line %l\, Column %c,'. From 85cd84e5b0b68d210a928e8d5a9e0e0b1c93b8cf Mon Sep 17 00:00:00 2001 From: unc0 Date: Wed, 29 May 2013 16:10:46 +0800 Subject: [PATCH 09/17] add oclint syntax checker for c/c++ --- syntax_checkers/c/oclint.vim | 53 ++++++++++++++++++++++++++++++++++ syntax_checkers/cpp/oclint.vim | 53 ++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 syntax_checkers/c/oclint.vim create mode 100644 syntax_checkers/cpp/oclint.vim diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim new file mode 100644 index 00000000..efd84f2e --- /dev/null +++ b/syntax_checkers/c/oclint.vim @@ -0,0 +1,53 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("loaded_oclint_syntax_checker") + finish +endif +let loaded_oclint_syntax_checker = 1 + +function! SyntaxCheckers_c_oclint_IsAvailable() + return executable("oclint") +endfunction + +if !exists('g:syntastic_oclint_config_file') + let g:syntastic_oclint_config_file = '.syntastic_oclint_config' +endif + +function! SyntaxCheckers_c_oclint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'oclint', + \ 'args': '-text', + \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'subchecker': 'oclint' }) + + let errorformat = + \ '%f:%l:%c:\ %m,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'postprocess': ['compressWhitespace'], + \ 'defaults': {'type': 'W'} }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'c', + \ 'name': 'oclint'}) diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim new file mode 100644 index 00000000..d6e43dde --- /dev/null +++ b/syntax_checkers/cpp/oclint.vim @@ -0,0 +1,53 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("loaded_oclint_syntax_checker") + finish +endif +let loaded_oclint_syntax_checker = 1 + +function! SyntaxCheckers_cpp_oclint_IsAvailable() + return executable("oclint") +endfunction + +if !exists('g:syntastic_oclint_config_file') + let g:syntastic_oclint_config_file = '.syntastic_oclint_config' +endif + +function! SyntaxCheckers_cpp_oclint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'oclint', + \ 'args': '-text', + \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'subchecker': 'oclint' }) + + let errorformat = + \ '%f:%l:%c:\ %m,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'postprocess': ['compressWhitespace'], + \ 'defaults': {'type': 'W'} }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cpp', + \ 'name': 'oclint'}) From a0aff0f436cc8f852b876e69292fea2a34705fe6 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 14:25:33 +0300 Subject: [PATCH 10/17] OClint can check Objective-C files. Cleanup. --- syntax_checkers/c/oclint.vim | 20 +++++++---- syntax_checkers/cpp/oclint.vim | 20 +++++++---- syntax_checkers/objc/oclint.vim | 61 +++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 syntax_checkers/objc/oclint.vim diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index efd84f2e..32cdd57a 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -16,10 +16,10 @@ " " let g:syntastic_oclint_config_file = '.config' -if exists("loaded_oclint_syntax_checker") +if exists("g:loaded_syntastic_c_oclint_checker") finish endif -let loaded_oclint_syntax_checker = 1 +let g:loaded_syntastic_c_oclint_checker = 1 function! SyntaxCheckers_c_oclint_IsAvailable() return executable("oclint") @@ -37,15 +37,23 @@ function! SyntaxCheckers_c_oclint_GetLocList() \ 'subchecker': 'oclint' }) let errorformat = - \ '%f:%l:%c:\ %m,' . + \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: error: %m,' . \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace'], - \ 'defaults': {'type': 'W'} }) + \ 'postprocess': ['compressWhitespace', 'sort'] }) + + for n in range(len(loclist)) + if loclist[n]['text'] =~# ' P[12] \=$' + let loclist[n]['type'] = 'E' + endif + endfor + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim index d6e43dde..b3edbfbc 100644 --- a/syntax_checkers/cpp/oclint.vim +++ b/syntax_checkers/cpp/oclint.vim @@ -16,10 +16,10 @@ " " let g:syntastic_oclint_config_file = '.config' -if exists("loaded_oclint_syntax_checker") +if exists("g:loaded_syntastic_cpp_oclint_checker") finish endif -let loaded_oclint_syntax_checker = 1 +let g:loaded_syntastic_cpp_oclint_checker = 1 function! SyntaxCheckers_cpp_oclint_IsAvailable() return executable("oclint") @@ -37,15 +37,23 @@ function! SyntaxCheckers_cpp_oclint_GetLocList() \ 'subchecker': 'oclint' }) let errorformat = - \ '%f:%l:%c:\ %m,' . + \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: error: %m,' . \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace'], - \ 'defaults': {'type': 'W'} }) + \ 'postprocess': ['compressWhitespace', 'sort'] }) + + for n in range(len(loclist)) + if loclist[n]['text'] =~# ' P[12] \=$' + let loclist[n]['type'] = 'E' + endif + endfor + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objc/oclint.vim b/syntax_checkers/objc/oclint.vim new file mode 100644 index 00000000..4441b2a5 --- /dev/null +++ b/syntax_checkers/objc/oclint.vim @@ -0,0 +1,61 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("g:loaded_syntastic_objc_oclint_checker") + finish +endif +let g:loaded_syntastic_objc_oclint_checker = 1 + +function! SyntaxCheckers_objc_oclint_IsAvailable() + return executable("oclint") +endfunction + +if !exists('g:syntastic_oclint_config_file') + let g:syntastic_oclint_config_file = '.syntastic_oclint_config' +endif + +function! SyntaxCheckers_objc_oclint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'oclint', + \ 'args': '-text', + \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'subchecker': 'oclint' }) + + let errorformat = + \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: error: %m,' . + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'postprocess': ['compressWhitespace', 'sort'] }) + + for n in range(len(loclist)) + if loclist[n]['text'] =~# ' P[12] \=$' + let loclist[n]['type'] = 'E' + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objc', + \ 'name': 'oclint'}) From 76b90995f5ad48c6ba562a58b873cbf073946b7a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 14:50:29 +0300 Subject: [PATCH 11/17] Uniform naming for load guards. --- syntax_checkers/c/checkpatch.vim | 6 +++--- syntax_checkers/c/make.vim | 4 ++-- syntax_checkers/c/sparse.vim | 4 ++-- syntax_checkers/c/splint.vim | 4 ++-- syntax_checkers/c/ycm.vim | 4 ++-- syntax_checkers/cpp/ycm.vim | 4 ++-- syntax_checkers/objc/ycm.vim | 4 ++-- syntax_checkers/vala/valac.vim | 5 +++++ syntax_checkers/vhdl/ghdl.vim | 4 ++-- 9 files changed, 22 insertions(+), 17 deletions(-) diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 90745ef7..15066bac 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -1,6 +1,6 @@ "============================================================================ "File: checkpatch.vim -"Description: Syntax checking plugin for syntastic.vim using checkpatch.pl +"Description: Syntax checking plugin for syntastic.vim using checkpatch.pl "Maintainer: Daniel Walker "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute @@ -8,10 +8,10 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -if exists("loaded_checkpatch_syntax_checker") +if exists("g:loaded_syntastic_c_checkpatch_checker") finish endif -let loaded_checkpatch_syntax_checker = 1 +let g:loaded_syntastic_c_checkpatch_checker = 1 " Bail if the user doesn't have `checkpatch.pl` or ./scripts/checkpatch.pl installed. if executable("checkpatch.pl") diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index 68557ac7..a0ccbf61 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists('loaded_make_syntax_checker') +if exists('g:loaded_syntastic_c_make_checker') finish endif -let loaded_make_syntax_checker = 1 +let g:loaded_syntastic_c_make_checker = 1 function SyntaxCheckers_c_make_IsAvailable() return executable('make') diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 5db60241..f4d0013b 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -16,10 +16,10 @@ " " let g:syntastic_sparse_config_file = '.config' -if exists("loaded_sparse_syntax_checker") +if exists("g:loaded_syntastic_c_sparse_checker") finish endif -let loaded_sparse_syntax_checker = 1 +let g:loaded_syntastic_c_sparse_checker = 1 function! SyntaxCheckers_c_sparse_IsAvailable() return executable("sparse") diff --git a/syntax_checkers/c/splint.vim b/syntax_checkers/c/splint.vim index e71349e0..3fa92a7a 100644 --- a/syntax_checkers/c/splint.vim +++ b/syntax_checkers/c/splint.vim @@ -16,10 +16,10 @@ " " let g:syntastic_splint_config_file = '.config' -if exists("loaded_splint_syntax_checker") +if exists("g:loaded_syntastic_c_splint_checker") finish endif -let loaded_splint_syntax_checker = 1 +let g:loaded_syntastic_c_splint_checker = 1 function! SyntaxCheckers_c_splint_IsAvailable() return executable("splint") diff --git a/syntax_checkers/c/ycm.vim b/syntax_checkers/c/ycm.vim index bc35b7cf..5cce6fc5 100644 --- a/syntax_checkers/c/ycm.vim +++ b/syntax_checkers/c/ycm.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists("loaded_ycm_c_syntax_checker") +if exists("g:loaded_syntastic_c_ycm_checker") finish endif -let loaded_ycm_c_syntax_checker = 1 +let g:loaded_syntastic_c_ycm_checker = 1 function! SyntaxCheckers_c_ycm_IsAvailable() return exists('g:loaded_youcompleteme') diff --git a/syntax_checkers/cpp/ycm.vim b/syntax_checkers/cpp/ycm.vim index 97827a08..f7c19e95 100644 --- a/syntax_checkers/cpp/ycm.vim +++ b/syntax_checkers/cpp/ycm.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists("loaded_ycm_cpp_syntax_checker") +if exists("g:loaded_syntastic_cpp_ycm_checker") finish endif -let loaded_ycm_cpp_syntax_checker = 1 +let g:loaded_syntastic_cpp_ycm_checker = 1 runtime syntax_checkers/c/ycm.vim diff --git a/syntax_checkers/objc/ycm.vim b/syntax_checkers/objc/ycm.vim index 1406dd83..a2250a3c 100644 --- a/syntax_checkers/objc/ycm.vim +++ b/syntax_checkers/objc/ycm.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists("loaded_ycm_objc_syntax_checker") +if exists("g:loaded_syntastic_objc_ycm_checker") finish endif -let loaded_ycm_objc_syntax_checker = 1 +let g:loaded_syntastic_objc_ycm_checker = 1 runtime syntax_checkers/c/ycm.vim diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index a7457235..b4ede28a 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -22,6 +22,11 @@ " "============================================================================ +if exists("g:loaded_syntastic_vala_valac_checker") + finish +endif +let g:loaded_syntastic_vala_valac_checker = 1 + function! SyntaxCheckers_vala_valac_IsAvailable() return executable('valac') endfunction diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index 57faa9de..4c7a39f7 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -9,10 +9,10 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -if exists("loaded_vhdl_ghdl_syntax_checker") +if exists("g:loaded_syntastic_vhdl_ghdl_checker") finish endif -let loaded_vhdl_ghdl_syntax_checker = 1 +let g:loaded_syntastic_vhdl_ghdl_checker = 1 function! SyntaxCheckers_vhdl_ghdl_IsAvailable() return executable("ghdl") From 3c41ef06b3e0ce76dae9b5066df182673c059525 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 14:57:29 +0300 Subject: [PATCH 12/17] Remove duplicated code. --- syntax_checkers/cpp/oclint.vim | 33 ++++----------------------------- syntax_checkers/objc/oclint.vim | 33 ++++----------------------------- 2 files changed, 8 insertions(+), 58 deletions(-) diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim index b3edbfbc..1586d835 100644 --- a/syntax_checkers/cpp/oclint.vim +++ b/syntax_checkers/cpp/oclint.vim @@ -21,39 +21,14 @@ if exists("g:loaded_syntastic_cpp_oclint_checker") endif let g:loaded_syntastic_cpp_oclint_checker = 1 +runtime syntax_checkers/c/oclint.vim + function! SyntaxCheckers_cpp_oclint_IsAvailable() - return executable("oclint") + return SyntaxCheckers_c_oclint_IsAvailable() endfunction -if !exists('g:syntastic_oclint_config_file') - let g:syntastic_oclint_config_file = '.syntastic_oclint_config' -endif - function! SyntaxCheckers_cpp_oclint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'oclint', - \ 'args': '-text', - \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), - \ 'subchecker': 'oclint' }) - - let errorformat = - \ '%W%f:%l:%c: %m,' . - \ '%E%f:%l:%c: error: %m,' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace', 'sort'] }) - - for n in range(len(loclist)) - if loclist[n]['text'] =~# ' P[12] \=$' - let loclist[n]['type'] = 'E' - endif - endfor - - return loclist + return SyntaxCheckers_c_oclint_GetLocList() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objc/oclint.vim b/syntax_checkers/objc/oclint.vim index 4441b2a5..59a3996b 100644 --- a/syntax_checkers/objc/oclint.vim +++ b/syntax_checkers/objc/oclint.vim @@ -21,39 +21,14 @@ if exists("g:loaded_syntastic_objc_oclint_checker") endif let g:loaded_syntastic_objc_oclint_checker = 1 +runtime syntax_checkers/c/oclint.vim + function! SyntaxCheckers_objc_oclint_IsAvailable() - return executable("oclint") + return SyntaxCheckers_c_oclint_IsAvailable() endfunction -if !exists('g:syntastic_oclint_config_file') - let g:syntastic_oclint_config_file = '.syntastic_oclint_config' -endif - function! SyntaxCheckers_objc_oclint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'oclint', - \ 'args': '-text', - \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), - \ 'subchecker': 'oclint' }) - - let errorformat = - \ '%W%f:%l:%c: %m,' . - \ '%E%f:%l:%c: error: %m,' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace', 'sort'] }) - - for n in range(len(loclist)) - if loclist[n]['text'] =~# ' P[12] \=$' - let loclist[n]['type'] = 'E' - endif - endfor - - return loclist + return SyntaxCheckers_c_oclint_GetLocList() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 5a734397757e41f3eb16982308bef56540c45cfc Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 18:03:14 +0300 Subject: [PATCH 13/17] New checker: text/atdtool. --- syntax_checkers/text/atdtool.vim | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 syntax_checkers/text/atdtool.vim diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim new file mode 100644 index 00000000..0a687b2a --- /dev/null +++ b/syntax_checkers/text/atdtool.vim @@ -0,0 +1,50 @@ +"============================================================================ +"File: atdtool.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_text_atdtool_checker") + finish +endif +let g:loaded_syntastic_text_atdtool_checker = 1 + +function! SyntaxCheckers_text_atdtool_IsAvailable() + return executable('atdtool') +endfunction + +function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) + return matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') +endfunction + +function! SyntaxCheckers_text_atdtool_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'atdtool', + \ 'tail': '2>/dev/null', + \ 'subchecker': 'atdtool' }) + + let errorformat = + \ '%W%f:%l:%c: %m,'. + \ '%+C suggestions:%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) + + for n in range(len(loclist)) + let loclist[n]['text'] = substitute(loclist[n]['text'], '\n\s\+', ' | ', 'g') + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'text', + \ 'name': 'atdtool'}) From 5393d3b040e2feb7f208b75e57d55ab8cb5ebeff Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 13:01:37 +0300 Subject: [PATCH 14/17] Better handling of errorformat for OClint. --- syntax_checkers/c/oclint.vim | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 32cdd57a..96687e61 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -37,23 +37,18 @@ function! SyntaxCheckers_c_oclint_GetLocList() \ 'subchecker': 'oclint' }) let errorformat = - \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: %m P1 ,' . + \ '%E%f:%l:%c: %m P2 ,' . + \ '%W%f:%l:%c: %m P3 ,' . \ '%E%f:%l:%c: error: %m,' . + \ '%W%f:%l:%c: warning: %m,' . \ '%-G%.%#' - let loclist = SyntasticMake({ + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'postprocess': ['compressWhitespace', 'sort'] }) - - for n in range(len(loclist)) - if loclist[n]['text'] =~# ' P[12] \=$' - let loclist[n]['type'] = 'E' - endif - endfor - - return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 3c5323c1036137b2447b475d8d6e6a78babe8d38 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 18:40:37 +0300 Subject: [PATCH 15/17] More errorformar adjustments for OClint. --- syntax_checkers/c/oclint.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 96687e61..f51c5494 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -40,6 +40,7 @@ function! SyntaxCheckers_c_oclint_GetLocList() \ '%E%f:%l:%c: %m P1 ,' . \ '%E%f:%l:%c: %m P2 ,' . \ '%W%f:%l:%c: %m P3 ,' . + \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%-G%.%#' From ec434f50b189b3ba990052bd237e1da4f9c9c576 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 18:55:39 +0300 Subject: [PATCH 16/17] Added checkers for Objective-C++ (mostly cloned from Objective-C). --- syntax_checkers/objcpp/gcc.vim | 184 ++++++++++++++++++++++++++++++ syntax_checkers/objcpp/oclint.vim | 36 ++++++ syntax_checkers/objcpp/ycm.vim | 34 ++++++ 3 files changed, 254 insertions(+) create mode 100644 syntax_checkers/objcpp/gcc.vim create mode 100644 syntax_checkers/objcpp/oclint.vim create mode 100644 syntax_checkers/objcpp/ycm.vim diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim new file mode 100644 index 00000000..8d8a2ebd --- /dev/null +++ b/syntax_checkers/objcpp/gcc.vim @@ -0,0 +1,184 @@ +"============================================================================ +"File: objcpp.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Gregor Uhlenheuer +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +" In order to also check header files add this to your .vimrc: +" (this usually creates a .gch file in your source directory) +" +" let g:syntastic_objcpp_check_header = 1 +" +" To disable the search of included header files after special +" libraries like gtk and glib add this line to your .vimrc: +" +" let g:syntastic_objcpp_no_include_search = 1 +" +" To disable the include of the default include dirs (such as /usr/include) +" add this line to your .vimrc: +" +" let g:syntastic_objcpp_no_default_include_dirs = 1 +" +" To enable header files being re-checked on every file write add the +" following line to your .vimrc. Otherwise the header files are checked only +" one time on initially loading the file. +" In order to force syntastic to refresh the header includes simply +" unlet b:syntastic_objcpp_includes. Then the header files are being re-checked on +" the next file write. +" +" let g:syntastic_objcpp_auto_refresh_includes = 1 +" +" Alternatively you can set the buffer local variable b:syntastic_objcpp_cflags. +" If this variable is set for the current buffer no search for additional +" libraries is done. I.e. set the variable like this: +" +" let b:syntastic_objcpp_cflags = ' -I/usr/include/libsoup-2.4' +" +" In order to add some custom include directories that should be added to the +" gcc command line you can add those to the global variable +" g:syntastic_objcpp_include_dirs. This list can be used like this: +" +" let g:syntastic_objcpp_include_dirs = [ 'includes', 'headers' ] +" +" Moreover it is possible to add additional compiler options to the syntax +" checking execution via the variable 'g:syntastic_objcpp_compiler_options': +" +" let g:syntastic_objcpp_compiler_options = ' -ansi' +" +" Additionally the setting 'g:syntastic_objcpp_config_file' allows you to define a +" file that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_objcpp_config': +" +" let g:syntastic_objcpp_config_file = '.config' +" +" Using the global variable 'g:syntastic_objcpp_remove_include_errors' you can +" specify whether errors of files included via the g:syntastic_objcpp_include_dirs' +" setting are removed from the result set: +" +" let g:syntastic_objcpp_remove_include_errors = 1 +" +" Use the variable 'g:syntastic_objcpp_errorformat' to override the default error +" format: +" +" let g:syntastic_objcpp_errorformat = '%f:%l:%c: %trror: %m' +" +" Set your compiler executable with e.g. (defaults to gcc) +" +" let g:syntastic_objcpp_compiler = 'clang' + +if exists('g:loaded_syntastic_objcpp_gcc_checker') + finish +endif +let g:loaded_syntastic_objcpp_gcc_checker = 1 + +if !exists('g:syntastic_objcpp_compiler') + let g:syntastic_objcpp_compiler = 'gcc' +endif + +function! SyntaxCheckers_objcpp_gcc_IsAvailable() + return executable(g:syntastic_objcpp_compiler) +endfunction + +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:syntastic_objcpp_compiler_options') + let g:syntastic_objcpp_compiler_options = '-std=gnu99' +endif + +if !exists('g:syntastic_objcpp_config_file') + let g:syntastic_objcpp_config_file = '.syntastic_objcpp_config' +endif + +function! SyntaxCheckers_objcpp_gcc_GetLocList() + let makeprg = g:syntastic_objcpp_compiler . ' -x objective-c++ -fsyntax-only -lobjc' + let errorformat = + \ '%-G%f:%s:,' . + \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . + \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . + \ '%-GIn file included%.%#,'. + \ '%-G %#from %f:%l\,,' . + \ '%f:%l:%c: %trror: %m,' . + \ '%f:%l:%c: %tarning: %m,' . + \ '%f:%l:%c: %m,' . + \ '%f:%l: %trror: %m,' . + \ '%f:%l: %tarning: %m,' . + \ '%f:%l: %m' + + if exists('g:syntastic_objcpp_errorformat') + let errorformat = g:syntastic_objcpp_errorformat + endif + + " add optional user-defined compiler options + let makeprg .= g:syntastic_objcpp_compiler_options + + let makeprg .= ' ' . shellescape(expand('%')) . + \ ' ' . syntastic#c#GetIncludeDirs('objcpp') + + " determine whether to parse header files as well + if expand('%') =~? '\.h$' + if exists('g:syntastic_objcpp_check_header') + let makeprg = g:syntastic_objcpp_compiler . + \ ' -x objective-c++-header ' . + \ ' -c ' . shellescape(expand('%')) . + \ ' ' . g:syntastic_objcpp_compiler_options . + \ ' ' . syntastic#c#GetIncludeDirs('objcpp') + else + return [] + endif + endif + + " check if the user manually set some cflags + if !exists('b:syntastic_objcpp_cflags') + " check whether to search for include files at all + if !exists('g:syntastic_objcpp_no_include_search') || + \ g:syntastic_objcpp_no_include_search != 1 + " refresh the include file search if desired + if exists('g:syntastic_objcpp_auto_refresh_includes') && + \ g:syntastic_objcpp_auto_refresh_includes != 0 + let makeprg .= syntastic#c#SearchHeaders() + else + " search for header includes if not cached already + if !exists('b:syntastic_objcpp_includes') + let b:syntastic_objcpp_includes = syntastic#c#SearchHeaders() + endif + let makeprg .= b:syntastic_objcpp_includes + endif + endif + else + " use the user-defined cflags + let makeprg .= b:syntastic_objcpp_cflags + endif + + " add optional config file parameters + let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objcpp_config_file) + + " process makeprg + let errors = SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + " filter the processed errors if desired + if exists('g:syntastic_objcpp_remove_include_errors') && + \ g:syntastic_objcpp_remove_include_errors != 0 + return filter(errors, + \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) + else + return errors + endif +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'gcc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/objcpp/oclint.vim b/syntax_checkers/objcpp/oclint.vim new file mode 100644 index 00000000..9a02abb7 --- /dev/null +++ b/syntax_checkers/objcpp/oclint.vim @@ -0,0 +1,36 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("g:loaded_syntastic_objcpp_oclint_checker") + finish +endif +let g:loaded_syntastic_objcpp_oclint_checker = 1 + +runtime syntax_checkers/c/oclint.vim + +function! SyntaxCheckers_objcpp_oclint_IsAvailable() + return SyntaxCheckers_c_oclint_IsAvailable() +endfunction + +function! SyntaxCheckers_objcpp_oclint_GetLocList() + return SyntaxCheckers_c_oclint_GetLocList() +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'oclint'}) diff --git a/syntax_checkers/objcpp/ycm.vim b/syntax_checkers/objcpp/ycm.vim new file mode 100644 index 00000000..14f73517 --- /dev/null +++ b/syntax_checkers/objcpp/ycm.vim @@ -0,0 +1,34 @@ +"============================================================================ +"File: ycm.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Val Markovic +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_objcpp_ycm_checker") + finish +endif +let g:loaded_syntastic_objcpp_ycm_checker = 1 + +runtime syntax_checkers/c/ycm.vim + +function! SyntaxCheckers_objcpp_ycm_IsAvailable() + return SyntaxCheckers_c_ycm_IsAvailable() +endfunction + +if !exists('g:loaded_youcompleteme') + finish +endif + +function! SyntaxCheckers_objcpp_ycm_GetLocList() + return SyntaxCheckers_c_ycm_GetLocList() +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'ycm'}) From bad592ece864f2a5c253efc01fcd9752ae9a5b76 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 19:08:12 +0300 Subject: [PATCH 17/17] Minor fixes. --- README.markdown | 9 +++++---- plugin/syntastic/registry.vim | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index 1daa1696..fb8423ef 100644 --- a/README.markdown +++ b/README.markdown @@ -29,10 +29,11 @@ At the time of this writing, syntax checking plugins exist for Ada, AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, HTML, Java, JavaScript, JSON, LESS, -LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, OCaml, -Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Ruby, Rust, -SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, VHDL, xHtml, -XML, XSLT, YAML, z80, Zope page templates, zsh. +LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, +Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, +reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, +TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page +templates, zsh. ## Screenshot diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 5fc01b65..07495f08 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -9,7 +9,11 @@ let s:defaultCheckers = { \ 'cpp': ['gcc'], \ 'html': ['tidy'], \ 'java': ['javac'], + \ 'javascript': ['jshint', 'jslint'], \ 'objc': ['gcc'], + \ 'objcpp': ['gcc'], + \ 'perl': ['perl'], + \ 'python': ['python', 'flake8', 'pylint'], \ 'php': ['php', 'phpcs', 'phpmd'], \ 'ruby': ['mri'] \ }