-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for ini file to spot python project root #755
Conversation
When looking for the project root folder it would be better to check for some well-known init file instead of __init__.py. Indeed, with python3 it is now possible to have namespace modules where intermediate dirs are not required to include the __init__.py file.
autoload/ale/python.vim
Outdated
|
||
function! ale#python#FindProjectRootIni(buffer) abort | ||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) | ||
if filereadable(l:path . 'MANIFEST.in') || filereadable(l:path . '/setup.cfg') || filereadable(l:path . '/pytest.ini') || filereadable(l:path . '/tox.ini') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Break your or conditions over several lines with \||
. Look at similar code.
autoload/ale/python.vim
Outdated
let l:ini_root = ale#python#FindProjectRootIni(a:buffer) | ||
if !empty(l:ini_root) | ||
return l:ini_root | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add blank lines before and after if statements and so on that don't start a new block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks better. Could you add some Vader tests to cover every case? Look for existing tests which look for nearby files in the command_callback
directory and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. 👍
The comment above |
* upstream/master: (23 commits) dense-analysis#764 - Update the documentation to mention how to echo messages with the ALELint autocmd Simplify the tests for the ALELint autocmd command Add scalastyle linter (dense-analysis#766) dense-analysis#697 - Remove highlights more thoroughly dense-analysis#769 Ignore stderr output and output without JSON we can read for rubocop Make tsserver completion more reliable, but not quite ready for documentation yet Rubocop: handle empty 'files' array in output Fix dense-analysis#760 - Report problems with configuration files for rubocop Add rails_best_practices handler (resolves dense-analysis#655) (dense-analysis#751) Fix docs for FindProjectRoot function Fixup dense-analysis#756 dense-analysis#756 Escape the paths used for the --include parameter for gometalinter, which uses RE2 Fix documentation typo Fix dense-analysis#747 - Lint and fix files after they have been been written to disk, not during writing them Look for ini file to spot python project root (dense-analysis#755) Make gometalinter work again Prefer --fast for stack-build (dense-analysis#754) Fix comment typo Brakeman: Remove unused cache var from tests Kotlin and general Gradle support. (dense-analysis#745) ...
When looking for the project root folder it would be better to check for some well-known init file instead of init.py. Indeed, with python3 it is now possible to have namespace modules where intermediate dirs are not required to include the init.py file.