summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-05-21 00:15:12 +0100
committerGitHub <noreply@github.com>2019-05-21 00:15:12 +0100
commit89db85121c001fc60787647f012978a2328816a5 (patch)
tree7a0fccc359896108d3a2e9e2f6c05889689dbdd9
parent26e5948617e4aad8612bfb0ac958a5f483898716 (diff)
parent57736cdcccf46e0d6252b556e9a2b2a56a634754 (diff)
downloadale-89db85121c001fc60787647f012978a2328816a5.zip
Merge pull request #2502 from ericvw/flake8-config
Change Python project root dir detection for flake8 configuration
-rw-r--r--autoload/ale/python.vim2
-rw-r--r--doc/ale-python.txt2
-rw-r--r--test/python-test-files/python-package-project/.flake80
-rw-r--r--test/python-test-files/python-package-project/package-name/module.py0
-rw-r--r--test/test_python_find_project_root.vader11
5 files changed, 13 insertions, 2 deletions
diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim
index 2f28214b..7ed22367 100644
--- a/autoload/ale/python.vim
+++ b/autoload/ale/python.vim
@@ -25,7 +25,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/tox.ini')
\|| filereadable(l:path . '/mypy.ini')
\|| filereadable(l:path . '/pycodestyle.cfg')
- \|| filereadable(l:path . '/flake8.cfg')
+ \|| filereadable(l:path . '/.flake8')
\|| filereadable(l:path . '/.flake8rc')
\|| filereadable(l:path . '/pylama.ini')
\|| filereadable(l:path . '/pylintrc')
diff --git a/doc/ale-python.txt b/doc/ale-python.txt
index 7dd3b65d..43cdf648 100644
--- a/doc/ale-python.txt
+++ b/doc/ale-python.txt
@@ -29,7 +29,7 @@ ALE will look for configuration files with the following filenames. >
tox.ini
mypy.ini
pycodestyle.cfg
- flake8.cfg
+ .flake8
.flake8rc
pylama.ini
pylintrc
diff --git a/test/python-test-files/python-package-project/.flake8 b/test/python-test-files/python-package-project/.flake8
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/python-test-files/python-package-project/.flake8
diff --git a/test/python-test-files/python-package-project/package-name/module.py b/test/python-test-files/python-package-project/package-name/module.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/python-test-files/python-package-project/package-name/module.py
diff --git a/test/test_python_find_project_root.vader b/test/test_python_find_project_root.vader
new file mode 100644
index 00000000..176e819a
--- /dev/null
+++ b/test/test_python_find_project_root.vader
@@ -0,0 +1,11 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test')
+
+After:
+ call ale#test#RestoreDirectory()
+
+Execute(Detect root of Python project with .flake8 correctly):
+ call ale#test#SetFilename('python-test-files/python-package-project/package-name/module.py')
+ AssertEqual
+ \ ale#path#Simplify(g:dir . '/python-test-files/python-package-project'),
+ \ ale#python#FindProjectRoot(bufnr(''))