Previously we were only loading "official" checkers that had been added
to syntastic. Now we load any checker that is in the right directory.
This allows anyone to add custom checkers to any filetype that uses
`SyntasticLoadChecker()`
The advantage to this is that no 3rd party modules are required. People
new to Python probably won't have flake8/pyflakes/pylint installed. This
will get them basic syntax checking (no linting) out of the box.
Since we're only using ghc to check and lint the file and not actually create output, we can pass -fno-code which omits code generation and speeds up the check quite a bit.
* only check `executable()` for the sub checkers once - at the top of
the script
* recapitalize `s:getPHPMDErrors` to `s:GetPHPMDErrors` errors for
style consistency
* simplify the logic in `SyntaxCheckers_php_GetLocList`
If no syntax errors are found, `gofmt -l % 1>/dev/null` prints the file
name to STDOUT, which is redirected to /dev/null. Less to parse for
syntastic!
If errors are found, they are written to STDERR.
This invocation does not alter the source code, which has been indicated
in the comments.
Query RVM for the version of ruby that should be used to do the syntax
check.
This wont work if the user has different versions of ruby for different
directories (e.g. if they are using a project rvmrc) as it will only a
single ruby version per vim instance.
I think this should satisfy almost everyone though, so we can wait for
feedback before doing anything more hardcore.
The error message in 'puppet parser validate' changed between Puppet 2.x
and Puppet 3.0.0, preventing syntax errors from being caught.
In addition, the logic to apply --ignoreimport was falsely triggering on
3.0.0, because it was written assuming a major version of "2". The
--ignoreimport flag has been broken since 2.6.1, so I removed all of that
logic. In theory, it could be re-added for 2.6.0 and 0.2x.x, but the
version number checking didn't handle 0.2x.x, so I didn't reach back that
far.
If the line a ruby error occurs on is 'too long' it will truncate the line it
displays in the error output and wrap it in `...`. This breaks %p from finding
the correct column so this patch ignores lines starting with `...`
e.g. %p working
```
ruby -w -T1 -c broken.rb
broken.rb:2: syntax error, unexpected tIDENTIFIER, expecting $end
puts sprintf "%d, %.2f, %.2f, %.2f, %d" k, v
^
```
%p not working
```
ruby -w -T1 -c broken.rb
broken.rb:2: syntax error, unexpected tIDENTIFIER, expecting $end
...tf "%d, %.2f, %.2f, %.2f, %d" k, v[:cost], v[:val], v[:carri...
... ^
```
Sass partials depend on their parents files for context. This patch disables the
syntax checking for partials by default because of this. To enable checking of
partials let g:syntastic_sass_check_partials = 1. Fixes issue #300.
Using lessc to check a less file results in a NameError if the file references a
variable defined in a file that inherits it. This commit adds a new linter that
just calls the less parser instead. The variable g:syntastic_less_use_less_lint
should be set to use the linter over lessc.
The original fix for issue #7 used sed and didn't update the `executable` check
from cat to sed. This patch uses String.gsub when parsing an erb file instead,
as sed isn't neccesarily available.
The HTML5 <source> tag throws an error when using Tidy since exceptions
have been made for audio and video, we should also support the source
tag which can exist inside these calls.
slightly modified version of the C checker. I did a find/replace to make
it use "_objc_" instead of "_c_" . I also modified the errorformat to
look more like the cpp errorformat because I discovered that the entries
added to the C errorformat no longer seem to match anything.
The code to generate the makeprg was an epic jumble. Break it down into
separate methods.
Also, init several options at the top of the script and make some
executable() checks at the same time. This clears up some of the clutter
and means we only check it once - not on every syntax check.
999d3c1b added a filter on the errors list that checks for key/value
valid:1 in each element of the errors list. sh.vim doesn't use
SyntasticMake to check for errors so needs to add {valid:1} to each
result.
The current makeprg doesn't work with php-5.3. display_errors=0 has
disabled error outputting and error_log='' disables the error log. With
php-5.4 error_log='' is causing errors to be logged to stderr.
This patch disables the error_log and enables display_errors.
Theoretically errors are displayed on stdout, however php in mountain
lion seems to insist on outputting to stderr.
As we're now displaying errors rather than logging them to error format
has changed to no longer include 'PHP ' and I've removed duplicates.
This has been tested with PHP 5.3.13 with Suhosin-Patch (cli) (built: Jun 20
2012 17:05:20) (mountain lion) and PHP 5.4.4 (cli) (built: Jul 2 2012
16:33:50) Fedora 17
* move the doc for it to the top of the script to be consistent with
other syntax checkers
* dont define a s:checker var - just use the
g:syntastic_perl_efm_program variable. This simplifies things slightly
On systems where Ruby 1.8.7 is the default Ruby and users use
alternative suffixes (e.g., ruby19) or even rbenv or rvm Rubies, modern
Ruby syntax will be highlighted as an error.
The default behaviour in Syntastic is to run 'ruby' to check the syntax
of the script in question. This patch allows the user to specify a
different binary which may even be a full path. This should work on all
platforms.
let g:syntastic_ruby_exec = 'ruby19'
let g:syntastic_ruby_exec = '~/.rbenv/versions/1.9.2-p318/bin/ruby'
Move the coffeelint code out into its own function.
Init the coffeelint option once, at the top of the script. Change its
name so it begins with "syntastic_" - for namespacing purposes.
Previously we were using "medium verbosity" with `-W1`. The reason for
this is because using full verbosity caused some bogus repeated warnings
to appear in rspec files.
Enable full verbosity again and filter out the bogus warnings.
Closes#290
Cuda programs may produce different errors depending on the architecture of the
target hardware. The canonical example and reason for writing this patch, is the
lack of support for double precision numbers on older hardware. By default, nvcc
and thus syntastic, defaults to the most basic architecture. This can produce
false errors if the developer intends to compile for newer hardware and use
newer features.
Not defining g:syntastic_cuda_arch preserves this behavior. Otherwise the user
is expected to set it a valid arch flag, as listed by `nvcc --help`.
Example:
let g:syntastic_cuda_arch = "sm_20"
Some users might want to disable some checks for puppet-lint if they do
not intend to follow all of the style recommendations. There is
currently no way of doing that.
By adding a global variable synstastic_puppet_lint_arguments, one can
now set arguments to pass to puppet-lint via .vimrc.
Signed-off-by: Gabriel Filion <lelutin@gmail.com>
First example:
$ echo -e 'if (0)\nsome();\n}' | perl -c -
Semicolon seems to be missing at - line 1.
syntax error at - line 2, near ")
some"
Unmatched right curly bracket at - line 3, at end of line
- had compilation errors.
$ echo -e 'if (0)\nsome();\n}' | perl syntax_checkers/efm_perl.pl -c -
-:1:Semicolon seems to be missing
Second example:
$ echo -e 'if (0)' | perl -c -
syntax error at - line 1, at EOF
- had compilation errors.
$ echo -e 'if (0)' | perl syntax_checkers/efm_perl.pl -c -
It will compile all *.java files in the pwd and apply the errorformat string
from quickfix.txt
Interesting additional features would be:
* @argument files
* setting the pwd for javac
* perform only a syntax check (javac currently always builds class files)
That variable specify the file which contains a list of filename that
Closure Compiler processes at once.
It can be useful for a project using 'require' statement like node.js.
Previously the 2 checkers were in the same file - this is more "tidy"
(lol??).
Currently the logic to determine which checker is loaded is custom to
the checker. At some point the SyntasticLoadChecker() function should be
upgraded to be able to handle cases (like this one) where the name of
the checker doesnt imply the name(s) of the executables that have to be
checked for.
The logic for this option was reversed in 2 places. Puppet-lint should
have been getting disabled for old versions and if it wasnt installed,
but the logic was wrong.
The output of flake8 is ambiguous as to whether results should be
interpreted as warnings or errors. I have changed it to assume errors to
match the python/pyflakes checker.
In future we may want to change this or add items to the errorformat for
some specific warnings if they are annoying.
This fixes#203.
setting it to E_PARSE causes some errors to be missed - e.g.
`$a[$b][] $c;`
will not cause an error to get reported as this is classed as a compile
error, not a parse error.
This should fix#206.
This is needed to handle compound filetypes since we cant imply the
location of the syntax checker file from the filetype.
e.g. we want to load `syntax_checkers/python/pylint.vim`, but the
filetype is `python.django`. Previously this was causing `runtime
syntax_checkers/python.django/pylint.vim` to be executed.
* move the existing ruby checker to syntax_checkers/ruby/mri.vim
* add a skeleton checker for jruby
* load mri by default but add an option to specify which ruby checker to
load
This is in response to #185
* remove the public SyntasticHighlightErrors() function
* shift the above code into s:HighlightErrors(). This is called
automatically if g:syntastic_enable_highlighting is set
* to get the highlight regex we just look for a function called
Syntastic_<filetype>_GetHighlightRegex
* to force this function to be called, each error item must have the
'force_highlight_callback' key set
This code has one important functional change: now errors are *always*
highlighted if possible whereas previously they were only highlighted if
a call to SyntasticHighlightErrors was made.
The error messages that pyflakes outputs dont contain enough information
to classify them as errors or warnings. Apart from checking for all
known warning outputs and classifying the rest as errors (or vice versa)
there is no way classify.
Make the syntax checker class all results as errors. Individual warning
formats can be checked for later if they become a problem.
This addresses #189.
dont refer to g:syntastic_python_checker since - due to a previous
commit - this is not guaranteed to exist any more.
This change should have been done in the aforementioned commit - but I
failed.
display_errors might be turned of for php globally. In this case the
output of php -l does not contain the errors messages. Using this option
will turn the option on for the single call.
The parameter `g:syntastic_python_checker_args` can be used to pass additional
arguments to the Python syntax checker. Example configuration:
let g:syntastic_python_checker = "flake8"
let g:syntastic_python_checker_args = "--ignore=E501 --max-complexity=10"
Replace the color codes these regexes: /.\{-}/
This is needed for portability since, when using tmux, the output is not
colorized. Also, Im not sure that different terminals will
use the same codes for the colors - but Im no expert.
previously we assumed the user had efm_perl.pl installed as part of the
standard vim runtime, but this isnt so for CentOS and possibly for other
distros - see issue #159. Therefore, we now ship it with syntastic
itself.
Note: efm_perl.pl just munges the output of perl into a different
format. It may be worth investigating further and writing our own
errorformat to remove the dependency on efm_perl.
Javascript and json have multiple syntax checkers that can be loaded.
Previously the logic to determine which checker to load was basically
copied and pasted in both. The `go` checker will soon have more
than one option too so remove the duplication by sticking the
common code in the core.