dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.55k stars 1.43k forks source link

Linters present and enabled, yet no errors reported #300

Closed dbmzzo closed 7 years ago

dbmzzo commented 7 years ago

Hello,

I have a strange issue on NeoVim 0.1.7. Ale appears to be installed and running just fine, but does not report any errors, either in the gutter or status line. I currently have everything but esllnt disabled, though I have the same problem with the default setup. Running NeoVim with no other plugins enabled didn't fix the problem. I tried py files and have the same issue as with the javascript.

%{ALEGetStatusLine()} in my status line reads OK at all times.

:ALEInfo returns:

Current Filetype: javascript.jsx
Available Linters: ['eslint', 'flow', 'jscs', 'jshint']
Enabled Linters: ['eslint']

:!:!eslint -f unix --stdin < Header.js returns:

<text>:10:6: Parsing error: Unexpected token, expected ;

   8 |  *
   9 |  */
> 10 | onst Header = ({ wrap }) => {
     |      ^
  11 |
  12 |     onst wrapStyle = wrap ? styles.wrap : styles.nowrap;
  13 | [Error]

1 problem
shell returned 1

Any help would be appreciated. Thanks!

w0rp commented 7 years ago

Maybe ALE is using a different version of eslint from a node_modules directory which doesn't work. Have you tried setting let g:ale_javascript_eslint_use_global = 1? If that works, you might consider updating your eslint version in node_modules.

It could be a completely unrelated problem. That's just the most common one.

w0rp commented 7 years ago

What's your eslint version?

dbmzzo commented 7 years ago

let g:ale_javascript_eslint_use_global = 1 worked perfectly. Thanks so much! Love this project!

w0rp commented 7 years ago

Aha, I thought it might be that.

What was happens is that ALE looks for versions of eslint inside of node_modules automatically. This is useful for sharing the same version of eslint for a team, but could not be what you want. So that extra option is there to always use whatever global version of eslint you have instead.

It can be useful to get the local version updated and working if you can, if you're working in a team.

I'll close this issue now that you've got it running.

gaviriar commented 7 years ago

Im having the same problem. Is there a way to test that ALE is actually executing?

adelarsq commented 7 years ago

@gaviriar you can use :ALEInfo command.

gaviriar commented 7 years ago

Thanks for that Info, when I use the :ALEinfo command i can see the following output:

Current Filetype: python
Available Linters: ['flake8', 'mypy', 'pylint']
Enabled Linters: ['flake8', 'mypy', 'pylint']

So it seems that the linters are being identified, but I don't see any lint warnings or errors when evaluating %{ALEGetStatusLine()}.

Any suggestions on how to debug this?

w0rp commented 7 years ago

Could you tell me which version of Vim you are running, which OS you are testing on, and which version of flake8 you are using? If you're on a flake8 version before 3.0.0, you might try pulling ALE from GitHub again, as I just fixed an issue which broke older versions of flake8 today.

gaviriar commented 7 years ago

Hi,

Thanks for the reply. This is my environment: OS: MacOSX flake8==2.5.1 Vim: 8.0

I updated to the latest tip of master. And now I am seeing the previous issue gone. But now when the linter executes I get the following error messages:

E325: ATTENTION
"Projects/hooklib/Bugzilla.py" [dos] 207L, 7054C
Error detected while processing function ale#Lint:
line   17:
E715: Dictionary required
Error detected while processing function ale#Lint:
line   17:
E715: Dictionary required

I looked at :ALEinfo and this is what I see:

"Projects/hooklib/Bugzilla.py" [dos] 209L, 7058C written
 Current Filetype: python
Available Linters: ['0', 'mypy', 'pylint']
  Enabled Linters: ['0', 'mypy', 'pylint']  
lllama commented 7 years ago

I'm having a similar problem. I'm on Windows, with only python 3.6 installed. Vim is complied with python 3.5 support (not sure if you're shelling out or using Vim's inbuilt python).

The following file has a few flake8 errors (I only have flake8 installed)

import sys

def func():
    a = 1+1

if __name__ == "__main__":
    pass

ALEInfo:

 Current Filetype: python
 Available Linters: ['flake8', 'mypy', 'pylint']
   Enabled Linters: ['flake8', 'mypy', 'pylint']
w0rp commented 7 years ago

@gaviriar Where is that '0' coming from in the available linters? That's weird. I don't know what's going on with those errors there.

Have you modified the plugin in any way or set any options in your vimrc file?

gaviriar commented 7 years ago

Hi @w0rp,

Thanks for following up on this. I killed all running vim processes and restarted MacVim and this I did not see the '0' again in the list of available linters.

Think it was an issue with my environment. I can safely confirm that the linter is now working as expected thanks to the fixes you committed.

Sorry for the hassle!

w0rp commented 7 years ago

Cool, good to hear. :+1:

anhari commented 7 years ago

Hey, just wanted to say I'm running into this same issue on and Neovim 0.1.7, iTerm2 Build 3.0.14, and macOS 10.12.3. Hoping to switch to your project from neomake. Here are some results from running ALEInfo.

In elixir:


 Current Filetype: elixir
Available Linters: ['credo']
  Enabled Linters: ['credo']
 Linter Variables:

 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(finished - exit code 1) 'mix credo suggest --format=flycheck --read-from-stdin /Users/anhari/code/elixir/rumbl/web/controllers/user_controller.ex < /var/folders/c7/k799l5bx76j2yd9l9k5h_w000000gn/T/nvim7rbusZ/5/user_controller.ex'

In ruby:


 Current Filetype: ruby
Available Linters: ['rubocop']
  Enabled Linters: ['rubocop']
 Linter Variables:

let g:ale_ruby_rubocop_options = ''
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 0
let g:ale_lint_on_text_changed = 1
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:
w0rp commented 7 years ago

Do you have any other plugins currently installed, like Neomake, Syntastic, etc.? You might have to remove them first.

I do plan to get ALE to co-operate with existing linter plugins, if at all possible: https://github.com/w0rp/ale/wiki/Roadmap#co-operation-with-other-linter-plugins

anhari commented 7 years ago

I do have Syntastic installed since I build on top of thoughtbot's base set of dotfiles, but I disable the inherited syntastic with this:

let g:syntastic_mode_map = {
    \ "mode": "passive",
    \ "active_filetypes": [],
    \ "passive_filetypes": [] }
w0rp commented 7 years ago

It's possible that other linter plugins could cause conflicts. I'd try uninstalling them and running ALE again, to see if you still have problems. If you do find another linter plugin which conflicts with ALE, please raise an issue for it. I would like to have it so ALE cooperates with other plugins, if possible.

iamrenejr commented 5 years ago

Maybe ALE is using a different version of eslint from a node_modules directory which doesn't work. Have you tried setting let g:ale_javascript_eslint_use_global = 1? If that works, you might consider updating your eslint version in node_modules.

It could be a completely unrelated problem. That's just the most common one.

This also worked for me. Lifesaver! Thanks!