ANN: linter-julia plugin for Atom / Juno

linter-julia

=========================

This linter plugin for Linter provides an interface to Lint.jl. It will be used with files that have the “Julia” syntax.

Installation

Install package through Atom or use CLI:

$ apm install linter-julia

In order to use this package, you will need to install Julia and Lint.jl
(version 0.2.6 or higher).
To get Julia see: Download Julia and to get Lint.jl
see: GitHub - tonyhffong/Lint.jl: A lint tool for Julia code

Before Lint.jl version 0.2.6 is released,
you will need to do Pkg.checkout("Lint") after Pkg.add("Lint") command.
This will use the latest development version of the Lint.jl package.
After the version 0.2.6 is realeased, you can do Pkg.free("Lint").

Features v"0.2.1"

  • By default linter-julia uses Juno’s julia
  • User can give path to the julia, which they want to use for Linting

Issues and pull request are welcome.

Edit: won’t work on Windows environment. Follow it here and here.

14 Likes

Hey, this is great!

Would you mind making a PR to the JunoDocs for how to install the linter, and maybe how to use/tweak it?

https://github.com/JunoLab/JunoDocs.jl

You can probably start a new page on extensions: I hope this is just the first of many.

1 Like

Yes, I will. I made an issue of it PR to the JunoDocs for how to install the linter, and maybe how to use/tweak it · Issue #17 · AtomLinter/linter-julia · GitHub
First I will try to get it working on Windows.

I have installed the package through Atom on a Mac and done Pkg.checkout("Lint"), but I don’t see any linting information. Is there something else that needs doing?

julia> versioninfo()
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

Ah, it seems to be giving this message: 'julia' could not be spawned. Is it installed and on your path? If so please open an issue on the package spawning the process.

I even tried making a soft link instead of a bash alias, but I still get the same result.
Could linter-julia just use the address in julia-client to get the information about the location of the Julia binary?

1 Like

Hi,
I’m working on this. Mean while I add a configuration to settings, please update to 0.1.3:

Update on Windows bug: The linter is hanging · Issue #170 · tonyhffong/Lint.jl · GitHub, if someone else could reproduce it also on Windows that would be appreciated. That example works on my linux machine fine.

Thanks, I updated to 0.1.3 but still no linter info.

I can reproduce on Windows 7, Julia v0.5.0, Lint v0.2.5.
The Julia console hangs.

using Lint
str2 = """
          test = "a"
          kj
          """
msgs2 = lintfile("file", str2)

After pressing Ctrl-c:

ERROR: InterruptException:
 in string(::String, ::Char, ::Vararg{Char,N}) at .\strings\string.jl:179
 in splitdir(::String) at .\path.jl:53
 in lintpkgforfile(::String, ::Lint.LintContext) at C:\Users\plowman\.julia\v0.5\Lint\src\Lint.jl:68
 in lintfile(::String, ::String) at C:\Users\plowman\.julia\v0.5\Lint\src\Lint.jl:112

It is interesting that the InterruptException indicates a potential hang in string, and that this problem seems to only occur on Windows. Any help on tracking this problem down is appreciated.

Can you switch on console and see the output. Ctrl + Shift + I and then select Console log. It should look something like this:

There are still some connections errors, but the lintserver / client will recover those at some point and provide the Lint.jl messages.

I fixed the Windows bug: lintpkgforfile() while loop replaced with for loop to fix #170 by TeroFrondelius · Pull Request #188 · tonyhffong/Lint.jl · GitHub

The linter is very angry at me. It always wants me to use the function arguments, but in many traits setups I don’t want to. Is there any way turn off specific checks?

Yes and no. Not in linter-julia at the moment. This is a good feature request, because this seems to be a standard feature of other linter packages. Here is how to do it in Lint.jl: Features - Lint.jl, but if I understood it correctly, it’s not supporting your request. Please add an issue, I have an idea how to implement this.

No need to file an issue of ignoring messages. It was a smaller effort and it’s already implemented version 0.3.0.

1 Like

I still can’t get the linter to work.
I have opened the console and see no error messages, just

Server running on port /var/folders/h0/68t1xc991mq20mrkn6yy6n5h0000gn/T/lintserver41968fcs2Fd6meb6Zsock ...

from linter-julia.coffee [sm]:96.

Keep the log open and press Command + s (save the file), it will trigger the linting to start. You can press the Command + s few times and look the console output. You can see an example output here: https://github.com/TeroFrondelius/linter-julia/issues/20

And of course make some mistake, if there is no problem then nothing is shown.

If the issue persists, please update to latest version v0.3.0 and open an issue: https://github.com/TeroFrondelius/linter-julia/issues

Edit, one additional thing to check: make sure the package “linter” is installed. It seems that I haven’t declared it as a dependency.

Edit, one additional thing to check: make sure the package “linter” is installed. It seems that I haven’t declared it as a dependency.

That was it! :wink:

I had to do apm install linter, since I couldn’t find it by searching in the package list inside Atom.

Many thanks!

1 Like

When there is an undeclared symbol, could it say which symbol is undeclared?
(I guess this is a Lint.jl issue).

In linter-julia, I’m not sure how useful it is to give the error number (e.g. E321).

But overall, it’s very cool – nice work!

It would be nice to be able to click on the error message at the bottom of the window and have it jump to the corresponding line.

1 Like