Skip to content
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

Merged
merged 7 commits into from
Jul 11, 2017

Conversation

bugant
Copy link
Contributor

@bugant bugant commented Jul 11, 2017

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.

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.

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')
Copy link
Member

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.

let l:ini_root = ale#python#FindProjectRootIni(a:buffer)
if !empty(l:ini_root)
return l:ini_root
endif
Copy link
Member

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.

Copy link
Member

@w0rp w0rp left a 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.

Copy link
Member

@w0rp w0rp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. 👍

@w0rp w0rp merged commit 505d114 into dense-analysis:master Jul 11, 2017
@elebow
Copy link
Member

elebow commented Jul 12, 2017

The comment above ale#python#FindProjectRoot() should be updated to mention the new behavior.

rsrchboy added a commit to rsrchboy/ale that referenced this pull request Jul 15, 2017
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants