All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 call ale#assert#SetUpFixerTest('python', 'ruff_format')
4 let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
7 call ale#assert#TearDownFixerTest()
12 Execute(The ruff callback should not change directory if the option is set to 0):
13 let g:ale_python_ruff_format_change_directory = 0
15 let file_path = g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py'
17 silent execute 'file ' . fnameescape(file_path)
19 let fname = ale#Escape(ale#path#Simplify(file_path))
24 \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' format --stdin-filename ' . fname . ' -',
27 Execute(The ruff callback should respect custom options):
28 let g:ale_python_ruff_format_options = '--ignore F401 -q'
30 let file_path = g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py'
32 silent execute 'file ' . fnameescape(file_path)
34 let fname = ale#Escape(ale#path#Simplify(file_path))
38 \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
39 \ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff'))
40 \ . ' format --ignore F401 -q --stdin-filename '. fname . ' -',
43 Execute(Pipenv is detected when python_ruff_format_auto_pipenv is set):
44 let g:ale_python_ruff_format_auto_pipenv = 1
45 let g:ale_python_ruff_format_change_directory = 0
47 let file_path = '../test-files/python/pipenv/whatever.py'
49 call ale#test#SetFilename(file_path)
51 let fname = ale#Escape(ale#path#Simplify(g:dir . '/'. file_path))
56 \ 'command': ale#Escape('pipenv') . ' run ruff format --stdin-filename ' . fname . ' -'
59 Execute(Poetry is detected when python_ruff_auto_poetry is set):
60 let g:ale_python_ruff_format_auto_poetry = 1
61 let g:ale_python_ruff_format_change_directory = 0
63 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
65 let fname = ale#Escape(ale#path#Simplify(g:dir .'/../test-files/python/poetry/whatever.py'))
70 \ 'command': ale#Escape('poetry') . ' run ruff format --stdin-filename ' . fname . ' -'
73 Execute(Poetry is detected when python_ruff_format_auto_poetry is set, and cwd respects change_directory option):
74 let g:ale_python_ruff_format_auto_poetry = 1
75 let g:ale_python_ruff_format_change_directory = 1
77 call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
79 let fname = ale#Escape(ale#path#Simplify(g:dir .'/../test-files/python/poetry/whatever.py'))
83 \ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/poetry'),
84 \ 'command': ale#Escape('poetry') . ' run ruff format --stdin-filename ' . fname . ' -'
87 Execute(uv is detected when python_ruff_format_auto_uv is set):
88 let g:ale_python_ruff_format_auto_uv = 1
89 let g:ale_python_ruff_format_change_directory = 0
91 call ale#test#SetFilename('../test-files/python/uv/whatever.py')
93 let fname = ale#Escape(ale#path#Simplify(g:dir .'/../test-files/python/uv/whatever.py'))
98 \ 'command': ale#Escape('uv') . ' run ruff format --stdin-filename ' . fname . ' -'