summaryrefslogtreecommitdiff
path: root/test/command_callback/test_flake8_command_callback.vader
diff options
context:
space:
mode:
authorKonstantin Alekseev <mail@kalekseev.com>2019-10-22 00:38:54 +0300
committerKonstantin Alekseev <mail@kalekseev.com>2020-08-30 22:56:10 +0300
commit1462de6685d7d71b7adba9f1b5e4f568b40da6b1 (patch)
tree607422568e1454ee37825782a2cc617f4597986a /test/command_callback/test_flake8_command_callback.vader
parent0989da4a38c80983548db623d407d7178f2452d5 (diff)
downloadale-1462de6685d7d71b7adba9f1b5e4f568b40da6b1.zip
Run flake8 from project root by default.
Option `per-file-ignores` was introduced in flake8 version 3.7.0. It allows to ignore specific errors in specific files using glob syntax. For example `per-file-ignores = src/generated/*.py:F401` will ignore `F401` error in all python files in `src/generated`. Thus ale has to run flake8 from project root where .flake8 config is placed otherwise glob won't match linted file.
Diffstat (limited to 'test/command_callback/test_flake8_command_callback.vader')
-rw-r--r--test/command_callback/test_flake8_command_callback.vader23
1 files changed, 21 insertions, 2 deletions
diff --git a/test/command_callback/test_flake8_command_callback.vader b/test/command_callback/test_flake8_command_callback.vader
index f082a63a..0f370983 100644
--- a/test/command_callback/test_flake8_command_callback.vader
+++ b/test/command_callback/test_flake8_command_callback.vader
@@ -34,13 +34,32 @@ Execute(The flake8 callbacks should return the correct default values):
\]
Execute(The option for disabling changing directories should work):
- let g:ale_python_flake8_change_directory = 0
+ let g:ale_python_flake8_change_directory = 'off'
AssertLinter 'flake8', [
\ ale#Escape('flake8') . ' --version',
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
\]
+Execute(The option for changing directory to project root should work):
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_tox/namespace/foo/bar.py')
+
+ AssertLinter 'flake8', [
+ \ ale#Escape('flake8') . ' --version',
+ \ ale#path#CdString(ale#python#FindProjectRootIni(bufnr('')))
+ \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \]
+
+Execute(The option for changing directory to file dir should work):
+ let g:ale_python_flake8_change_directory = 'file'
+ silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_tox/namespace/foo/bar.py')
+
+ AssertLinter 'flake8', [
+ \ ale#Escape('flake8') . ' --version',
+ \ ale#path#BufferCdString(bufnr(''))
+ \ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
+ \]
+
Execute(The flake8 command callback should let you set options):
let g:ale_python_flake8_options = '--some-option'
@@ -163,5 +182,5 @@ Execute(Pipenv is detected when python_flake8_auto_pipenv is set):
call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
AssertLinter 'pipenv',
- \ ale#path#BufferCdString(bufnr(''))
+ \ ale#path#CdString(ale#python#FindProjectRootIni(bufnr('')))
\ . ale#Escape('pipenv') . ' run flake8 --format=default --stdin-display-name %s -'