From f769f64c079d2f3216559234fb92673182089267 Mon Sep 17 00:00:00 2001 From: Oliver Albertini Date: Wed, 15 Sep 2021 05:07:45 -0700 Subject: [ale-python-root] add `.pyre_configuration.local` to list of files (#3900) Without this, we have one `pyre` process running across different pyre projects. With this change, files in different projects can be linted with pyre at the same time. Co-authored-by: Oliver Ruben Albertini --- autoload/ale/python.vim | 1 + doc/ale-python.txt | 1 + test/linter/test_pyre.vader | 7 +++++++ .../python/pyre_configuration_dir/.pyre_configuration.local | 0 test/test-files/python/pyre_configuration_dir/foo/__init__.py | 0 test/test-files/python/pyre_configuration_dir/foo/bar.py | 0 6 files changed, 9 insertions(+) create mode 100644 test/test-files/python/pyre_configuration_dir/.pyre_configuration.local create mode 100644 test/test-files/python/pyre_configuration_dir/foo/__init__.py create mode 100644 test/test-files/python/pyre_configuration_dir/foo/bar.py diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim index ee856a27..81cb06e0 100644 --- a/autoload/ale/python.vim +++ b/autoload/ale/python.vim @@ -24,6 +24,7 @@ function! ale#python#FindProjectRootIni(buffer) abort \|| filereadable(l:path . '/setup.cfg') \|| filereadable(l:path . '/pytest.ini') \|| filereadable(l:path . '/tox.ini') + \|| filereadable(l:path . '/.pyre_configuration.local') \|| filereadable(l:path . '/mypy.ini') \|| filereadable(l:path . '/pycodestyle.cfg') \|| filereadable(l:path . '/.flake8') diff --git a/doc/ale-python.txt b/doc/ale-python.txt index 6e03e872..8f0d8ffa 100644 --- a/doc/ale-python.txt +++ b/doc/ale-python.txt @@ -35,6 +35,7 @@ ALE will look for configuration files with the following filenames. > setup.cfg pytest.ini tox.ini + .pyre_configuration.local mypy.ini pycodestyle.cfg .flake8 diff --git a/test/linter/test_pyre.vader b/test/linter/test_pyre.vader index 335e31f2..53f84e6f 100644 --- a/test/linter/test_pyre.vader +++ b/test/linter/test_pyre.vader @@ -57,3 +57,10 @@ Execute(Poetry is detected when python_pyre_auto_poetry is set): AssertLinter 'poetry', \ ale#Escape('poetry') . ' run pyre persistent' + +Execute(The FindProjectRoot should detect the project root directory for namespace package via .pyre_configuration.local): + silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/pyre_configuration_dir/foo/bar.py') + + AssertEqual + \ ale#path#Simplify(g:dir . '/../test-files/python/pyre_configuration_dir'), + \ ale#python#FindProjectRoot(bufnr('')) diff --git a/test/test-files/python/pyre_configuration_dir/.pyre_configuration.local b/test/test-files/python/pyre_configuration_dir/.pyre_configuration.local new file mode 100644 index 00000000..e69de29b diff --git a/test/test-files/python/pyre_configuration_dir/foo/__init__.py b/test/test-files/python/pyre_configuration_dir/foo/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/test-files/python/pyre_configuration_dir/foo/bar.py b/test/test-files/python/pyre_configuration_dir/foo/bar.py new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3