Skip to content

Commit

Permalink
Work around Steep path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lloeki committed Dec 6, 2023
1 parent 3aae03a commit 2e74504
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion ale_linters/ruby/steep.vim
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,34 @@ function! ale_linters#ruby#steep#FindRoot(buffer) abort
return ''
endfunction

" Rename path relative to root
function! ale_linters#ruby#steep#RelativeToRoot(buffer, path) abort
return substitute(a:path, ale_linters#ruby#steep#FindRoot(a:buffer) . '/', '', '')
endfunction

function! ale_linters#ruby#steep#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_steep_executable')

" steep check needs to apply some config from the file path so:
" - steep check can't use stdin (no path)
" - steep check can't use %t (path outside of project)
" => we can only use %s

" somehow :ALEInfo shows that ALE still appends '< %t' to the command
" => luckily steep check ignores stdin

" somehow steep has a problem with absolute path to file but a path
" relative to Steepfile directory works:
" see https://github.com/soutaro/steep/pull/975
" => change to Steepfile directory and remove leading path

let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p')
let l:buffer_filename = fnameescape(l:buffer_filename)

return ale#ruby#EscapeExecutable(l:executable, 'steep')
\ . ' check '
\ . ale#Var(a:buffer, 'ruby_steep_options')
\ . ' %s'
\ . ' ' . ale_linters#ruby#steep#RelativeToRoot(a:buffer, l:buffer_filename)
endfunction

function! ale_linters#ruby#steep#GetType(severity) abort
Expand Down

0 comments on commit 2e74504

Please sign in to comment.