Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala(c) linter is broken #2093

Closed
amanjpro opened this issue Nov 21, 2018 · 5 comments
Closed

Scala(c) linter is broken #2093

amanjpro opened this issue Nov 21, 2018 · 5 comments
Labels

Comments

@amanjpro
Copy link

Information

Information

VIM version

:version                                                                                                                                                                                                                                     
NVIM v0.3.1                                                                                                                                                                                                                                  
Build type: Release                                                                                                                                                                                                                          
LuaJIT 2.0.5                                                                                                                                                                                                                                 
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wconversion -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthr
ough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovi
m-0.3.1/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include                                                                                                                                         
Compiled by builduser                                                                                                                                                                                                                        
                                                                                                                                                                                                                                             
Features: +acl +iconv +jemalloc +tui                                                                                                                                                                                                         
See ":help feature-compile"                                                                                                                                                                                                                  
                                                                                                                                                                                                                                             
   system vimrc file: "$VIM/sysinit.vim"                                                                                                                                                                                                     
  fall-back for $VIM: "/usr/share/nvim"                                                                                                                                                                                                      
                                                                                                                                                                                                                                             
Run :checkhealth for more info

Operating System:

$ uname -a
Linux pc146 4.19.2-arch1-1-ARCH #1 SMP PREEMPT Tue Nov 13 21:16:19 UTC 2018 x86_64 GNU/Linux

What went wrong

I updated ale plugin, and all the sudden all my external scala objects showed as
unresolved, after a long debugging session, looked into the changelog of the ale
repo, and found this PR:

#2083

Rolling back to this commit makes the linter work agian.
1c89495

It is worth noting I was using scalac linter

Reproducing the bug

  1. Update ale to the latest commit in master
  2. Open any scala/sbt project, and observe all the false-red flags.

:ALEInfo

ALEInfo                                                                                                                                                                                                                                     
 Current Filetype: scala                                                                                                                                                                                                                     
Available Linters: ['fsc', 'sbtserver', 'scalac', 'scalastyle']                                                                                                                                                                              
  Enabled Linters: ['fsc', 'sbtserver', 'scalac', 'scalastyle']                                                                                                                                                                              
 Suggested Fixers:                                                                                                                                                                                                                           
  'remove_trailing_lines' - Remove all blank lines at the end of a file.                                                                                                                                                                     
  'scalafmt' - Fix Scala files using scalafmt                                                                                                                                                                                                
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.                                                                                                                                                    
 Linter Variables:                                                                                                                                                                                                                           
                                                                                                                                                                                                                                             
let g:ale_scala_sbtserver_address = '127.0.0.1:4273'                                                                                                                                                                                         
let g:ale_scala_sbtserver_project_root = ''                                                                                                                                                                                                  
let g:ale_scala_scalastyle_config = ''                                                                                                                                                                                                       
let g:ale_scala_scalastyle_options = ''                                                                                                                                                                                                      
 Global Variables:                                                                                                                                                                                                                           
                                                                                                                                                                                                                                             
let g:ale_cache_executable_check_failures = v:null                                                                                                                                                                                           
let g:ale_change_sign_column_color = 0                                                                                                                                                                                                       
let g:ale_command_wrapper = ''                                                                                                                                                                                                               
let g:ale_completion_delay = v:null                                                                                                                                                                                                          
let g:ale_completion_enabled = 0                                                                                                                                                                                                             
let g:ale_completion_max_suggestions = v:null                                                                                                                                                                                                
let g:ale_echo_cursor = 1                                                                                                                                                                                                                    
let g:ale_echo_msg_error_str = 'Error'                                                                                                                                                                                                       
let g:ale_echo_msg_format = '%code: %%s'                                                                                                                                                                                                     
let g:ale_echo_msg_info_str = 'Info'                                                                                                                                                                                                         
let g:ale_echo_msg_warning_str = 'Warning'                                                                                                                                                                                                   
let g:ale_enabled = 1                                                                                                                                                                                                                        
let g:ale_fix_on_save = 0                                                                                                                                                                                                                    
let g:ale_fixers = {}                                                                                                                                                                                                                        
let g:ale_history_enabled = 1                                                                                                                                                                                                                
let g:ale_history_log_output = 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_filetype_changed = 1                                                                                                                                                                                                       
let g:ale_lint_on_insert_leave = 0                                                                                                                                                                                                           
let g:ale_lint_on_save = 1                                                                                                                                                                                                                   
let g:ale_lint_on_text_changed = 'always'                                                                                                                                                                                                    
let g:ale_linter_aliases = {}                                                                                                                                                                                                                
let g:ale_linters = {}                                                                                                                                                                                                                       
let g:ale_linters_explicit = 0                                                                                                                                                                                                               
let g:ale_list_vertical = 0                                                                                                                                                                                                                  
let g:ale_list_window_size = 10                                                                                                                                                                                                              
let g:ale_loclist_msg_format = '%code: %%s'                                                                                                                                                                                                  
let g:ale_max_buffer_history_size = 20                                                                                                                                                                                                       
let g:ale_max_signs = -1                                                                                                                                                                                                                     
let g:ale_maximum_file_size = v:null                                                                                                                                                                                                         
let g:ale_open_list = 0                                                                                                                                                                                                                      
let g:ale_pattern_options = v:null                                                                                                                                                                                                           
let g:ale_pattern_options_enabled = v:null                                                                                                                                                                                                   
let g:ale_set_balloons = 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_info = '--'                                                                                                                                                                                                                   
let g:ale_sign_offset = 1000000                                                                                                                                                                                                              
let g:ale_sign_style_error = '>>'                                                                                                                                                                                                            
let g:ale_sign_style_warning = '--'                                                                                                                                                                                                          
let g:ale_sign_warning = '--'                                                                                                                                                                                                                
let g:ale_statusline_format = v:null                                                                                                                                                                                                         
let g:ale_type_map = {}                                                                                                                                                                                                                      
let g:ale_use_global_executables = v:null                                                                                                                                                                                                    
let g:ale_virtualtext_cursor = 0                                                                                                                                                                                                             
let g:ale_warn_about_trailing_blank_lines = 1
  Command History:                                                                                                                                                                                                                           
(executable check - success) fsc                                                                                                                                                                                                             
(started) ['/bin/bash', '-c', '''fsc'' -Ystop-after:parser ''/tmp/nvimNkw1Jr/1/LinearAdsFreqapApi.scala''']                                                                                                                                  
(executable check - success) scalac                                                                                                                                                                                                          
(started) ['/bin/bash', '-c', '''scalac'' -Ystop-before:jvm ''/tmp/nvimNkw1Jr/3/LinearAdsFreqapApi.scala''']                                                                                                                                 
(executable check - failure) scalastyle                                                                                                                                                                                                      
(finished - exit code 0) ['/bin/bash', '-c', '''fsc'' -Ystop-after:parser ''/tmp/nvimNkw1Jr/4/LinearAdsFreqapApi.scala''']                                                                                                                   
<<<NO OUTPUT RETURNED>>>                                                                                                                                                                                                                     
(finished - exit code 1) ['/bin/bash', '-c', '''scalac'' -Ystop-before:jvm ''/tmp/nvimNkw1Jr/5/LinearAdsFreqapApi.scala''']                                                                                                                  
<<<OUTPUT STARTS>>>                                                                                                                                                                                                                          
/tmp/nvimNkw1Jr/5/LinearAdsFreqapApi.scala:9: error: not found: object akka                                                                                                                                                                  
import akka.Done
...
Many many other similar errors
...
57 errors found                                                                                                                                                                                                                              
<<<OUTPUT ENDS>>>                                                                                                                                                                                                                            
(executable check - failure) scalastyle

It is worth sharing, that sbt compile/test have no issues

@amanjpro
Copy link
Author

This is the ALEInfo result after rolling back

  Command History:                                                                                                                                                                                                                           
(executable check - success) fsc                                                                                                                                                                                                             
(started) ['/bin/bash', '-c', '''fsc'' -Ystop-after:parser ''/tmp/nvim2NVUR0/1/LinearAdsFreqapApi.scala''']                                                                                                                                  
(executable check - success) scalac                                                                                                                                                                                                          
(started) ['/bin/bash', '-c', '''scalac'' -Ystop-after:parser ''/tmp/nvim2NVUR0/3/LinearAdsFreqapApi.scala''']                                                                                                                               
(executable check - failure) scalastyle                                                                                                                                                                                                      
(finished - exit code 0) ['/bin/bash', '-c', '''fsc'' -Ystop-after:parser ''/tmp/nvim2NVUR0/4/LinearAdsFreqapApi.scala''']                                                                                                                   
<<<NO OUTPUT RETURNED>>>                                                                                                                                                                                                                     
(finished - exit code 0) ['/bin/bash', '-c', '''scalac'' -Ystop-after:parser ''/tmp/nvim2NVUR0/5/LinearAdsFreqapApi.scala''']                                                                                                                
<<<NO OUTPUT RETURNED>>>                                                                                                                                                                                                                     
(executable check - failure) scalastyle

@w0rp
Copy link
Member

w0rp commented Dec 2, 2018

Sounds like -Ystop-before:jvm requires a newer version of scalac. What's your version of scalac? I think the solution here will be to add a version check which uses the flag which provides better output if the version is new enough, and falls back on the older option for older versions.

@w0rp w0rp added the bug label Dec 2, 2018
@amanjpro
Copy link
Author

amanjpro commented Dec 2, 2018

Actually I am using the latest scalac version:

$ scala -version
Scala code runner version 2.12.7 -- Copyright 2002-2018, LAMP/EPFL and Lightbend, Inc.

@w0rp
Copy link
Member

w0rp commented Dec 3, 2018

Right, I'll just revert the commit completely then, and I'll let the person who wrote the pull request know that what they wrote doesn't work.

@w0rp
Copy link
Member

w0rp commented Dec 3, 2018

Reverted now. We can consider making this an option, off by default, later.

@w0rp w0rp closed this as completed Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants