mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 21:44:47 +08:00
Some absolute paths are not recognized for Windows (#4987)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* Some abs paths are not recognized for win32 Paths like "c:/abc/def.cpp" were not recognized as absolute on Windows. * Fix test for mypy_handler mypy handler not just simplifies path, but tries to convert path to absolute.
This commit is contained in:
committed by
GitHub
parent
a0572359ae
commit
9e49019a26
@@ -115,12 +115,11 @@ endfunction
|
|||||||
|
|
||||||
" Return 1 if a path is an absolute path.
|
" Return 1 if a path is an absolute path.
|
||||||
function! ale#path#IsAbsolute(filename) abort
|
function! ale#path#IsAbsolute(filename) abort
|
||||||
if has('win32') && a:filename[:0] is# '\'
|
if has('win32')
|
||||||
return 1
|
return a:filename[:0] =~# '[\\/]' || a:filename[0:2] =~? '[A-Z]:[/\\]'
|
||||||
|
else
|
||||||
|
return a:filename[:0] is# '/'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Check for /foo and C:\foo, etc.
|
|
||||||
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h'))
|
let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h'))
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ Execute(The mypy handler should handle Windows names with spaces):
|
|||||||
\ {
|
\ {
|
||||||
\ 'lnum': 4,
|
\ 'lnum': 4,
|
||||||
\ 'col': 0,
|
\ 'col': 0,
|
||||||
\ 'filename': ale#path#Simplify('C:\something\with spaces.py'),
|
\ 'filename': ale#path#GetAbsPath(getcwd(), 'C:\something\with spaces.py'),
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'No library stub file for module ''django.db''',
|
\ 'text': 'No library stub file for module ''django.db''',
|
||||||
\ },
|
\ },
|
||||||
|
|||||||
@@ -13,6 +13,15 @@ Execute(Relative paths should be resolved correctly):
|
|||||||
AssertEqual
|
AssertEqual
|
||||||
\ 'C:\foo\bar\baz\whatever.txt',
|
\ 'C:\foo\bar\baz\whatever.txt',
|
||||||
\ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '../whatever.txt')
|
\ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '../whatever.txt')
|
||||||
|
AssertEqual
|
||||||
|
\ 'C:\foo\bar\baz\whatever.txt',
|
||||||
|
\ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '..\whatever.txt')
|
||||||
|
AssertEqual
|
||||||
|
\ 'C:\foo\bar\baz\whatever.txt',
|
||||||
|
\ ale#path#GetAbsPath('C:/foo/bar/baz/xyz', '../whatever.txt')
|
||||||
|
AssertEqual
|
||||||
|
\ 'C:\foo\bar\baz\whatever.txt',
|
||||||
|
\ ale#path#GetAbsPath('C:/foo/bar/baz/xyz', '..\whatever.txt')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
Execute(Absolute paths should be resolved correctly):
|
Execute(Absolute paths should be resolved correctly):
|
||||||
@@ -26,4 +35,12 @@ Execute(Absolute paths should be resolved correctly):
|
|||||||
|
|
||||||
if has('win32')
|
if has('win32')
|
||||||
AssertEqual '\ding', ale#path#GetAbsPath('/foo/bar/xyz', '\\ding')
|
AssertEqual '\ding', ale#path#GetAbsPath('/foo/bar/xyz', '\\ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('/foo/bar/xyz', 'c:/ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('/foo/bar/xyz', 'c:\ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('\foo\bar\xyz', 'c:/ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('\foo\bar\xyz', 'c:\ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:/foo/bar/xyz', 'c:/ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:/foo/bar/xyz', 'c:\ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:\foo\bar\xyz', 'c:/ding')
|
||||||
|
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:\foo\bar\xyz', 'c:\ding')
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user