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

Commit

Permalink
New checker julia/lint for Julia.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcd047 committed Apr 24, 2017
1 parent 0bfac45 commit b9d3535
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Expand Up @@ -62,7 +62,7 @@ AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C,
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata,
GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON,
JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown,
JSX, Julia, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown,
MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl
POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly
Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG,
Expand Down
32 changes: 32 additions & 0 deletions doc/syntastic-checkers.txt
Expand Up @@ -58,6 +58,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
Java.....................................|syntastic-checkers-java|
JavaScript...............................|syntastic-checkers-javascript|
JSON.....................................|syntastic-checkers-json|
Julia....................................|syntastic-checkers-julia|

LESS.....................................|syntastic-checkers-less|
Lex......................................|syntastic-checkers-lex|
Expand Down Expand Up @@ -3591,6 +3592,37 @@ Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|.

==============================================================================
SYNTAX CHECKERS FOR JULIA *syntastic-checkers-julia*

The following checkers are available for Julia (filetype "julia"):

1. lint.....................|syntastic-julia-lint|

------------------------------------------------------------------------------
1. lint *syntastic-julia-lint*

Name: lint
Maintainer: LCD 47 <lcd047@gmail.com>

This is a checker for Julia files (https://julialang.org/), using the Julia
package "Lint". See the package's documentation for more information:

http://lintjl.readthedocs.io/

Installation~

You need to install Julia itself, and the package "Lint". You can install
"Lint" from the Julia package manager, with the command: >
Pkg.add("Lint")
Checker Options~

This checker doesn't call the "makeprgBuild()" function, and thus it ignores
the usual 'g:syntastic_julia_lint_<option>' variables. The only exception is
'g:syntastic_julia_lint_exec', which can still be used to override the "julia"
executable.

==============================================================================
SYNTAX CHECKERS FOR LESS *syntastic-checkers-less*

Expand Down
2 changes: 1 addition & 1 deletion plugin/syntastic.vim
Expand Up @@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif

let g:_SYNTASTIC_VERSION = '3.8.0-40'
let g:_SYNTASTIC_VERSION = '3.8.0-41'
lockvar g:_SYNTASTIC_VERSION

" Sanity checks {{{1
Expand Down
1 change: 1 addition & 0 deletions plugin/syntastic/registry.vim
Expand Up @@ -50,6 +50,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'java': ['javac'],
\ 'javascript': ['jshint', 'jslint'],
\ 'json': ['jsonlint', 'jsonval'],
\ 'julia': [],
\ 'less': ['lessc'],
\ 'lex': ['flex'],
\ 'limbo': ['limbo'],
Expand Down
51 changes: 51 additions & 0 deletions syntax_checkers/julia/lint.vim
@@ -0,0 +1,51 @@
"============================================================================
"File: lint.vim
"Description: Syntax checking plugin for syntastic
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"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_julia_lint_checker')
finish
endif
let g:loaded_syntastic_julia_lint_checker = 1

let s:save_cpo = &cpo
set cpo&vim

function! SyntaxCheckers_julia_lint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m^\S\+\ze:')
return term !=# '' ? '\V' . escape(term, '\') : ''
endfunction

function! SyntaxCheckers_julia_lint_IsAvailable() dict
return
\ executable(self.getExec()) &&
\ syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('import Lint')) ==# '' &&
\ v:shell_error == 0
endfunction

function! SyntaxCheckers_julia_lint_GetLocList() dict
let buf = bufnr('')

let makeprg = self.getExecEscaped() . ' -e ' . syntastic#util#shescape('using Lint; display(filter(err -> !isinfo(err), lintfile("' . escape(bufname(buf), '\"') . '")))')

let errorformat = '%f:%l %t%n %m'

return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'julia',
\ 'name': 'lint',
\ 'exec': 'julia' })

let &cpo = s:save_cpo
unlet s:save_cpo

" vim: set sw=4 sts=4 et fdm=marker:

0 comments on commit b9d3535

Please sign in to comment.