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

Add flakehell python linter (#3295) #3921

Merged
merged 1 commit into from
Oct 2, 2021

Conversation

a666
Copy link
Contributor

@a666 a666 commented Sep 30, 2021

Adds flakehell.

For the moment it is just a blatant copy of the flake8 linter.

@a666 a666 force-pushed the feature/flakehell branch 13 times, most recently from bc29b6c to 59a820f Compare September 30, 2021 05:24
@a666 a666 marked this pull request as ready for review September 30, 2021 05:27
if (l:executable =~? 'pipenv\|poetry$')
let l:exec_args = ' run flakehell'
elseif (l:executable is? 'python')
let l:exec_args = ' -m flakehell'
Copy link
Contributor Author

@a666 a666 Sep 30, 2021

Choose a reason for hiding this comment

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

This seemed to make more sense that appending the module in the options.

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Impressive PR, thanks. One test on windows is failing, once that is fixed it looks good to merge:

    ( 7/17) [EXECUTE] (X) ['flakehell', ['flakehell --version', 'flakehell lint --format=default --stdin-display-name %s -']] should be equal to ['C:\testplugin\test\test-files\python\with_virtualenv\env\Scripts\flakehell', ['C:\testplugin\test\test-files\python\with_virtualenv\env\Scripts\flakehell --version', 'C:\testplugin\test\test-files\python\with_virtualenv\env\Scripts\flakehell lint --format=default --stdin-display-name %s -']]

@a666
Copy link
Contributor Author

a666 commented Sep 30, 2021

Thanks.
I'm unsure about how to fix that test, it is on parity with the (non-failing) flake8 test:

-Execute(The flake8 callbacks should detect virtualenv directories):
+Execute(The flakehell callbacks should detect virtualenv directories):
   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py')

   let b:executable = ale#path#Simplify(
-  \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/flake8'
+  \ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/flakehell'
   \)

   AssertLinter b:executable, [
   \ ale#Escape(b:executable) . ' --version',
   \ ale#Escape(b:executable)
+  \   . ' lint'
   \   . ' --format=default'
   \   . ' --stdin-display-name %s -',
   \]

And I don't see anything in the code that's done any differently with respect to flake8.
Am I missing something about windows?

@a666
Copy link
Contributor Author

a666 commented Oct 2, 2021

Final test now passes.

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution.

@hsanson hsanson merged commit f9deee0 into dense-analysis:master Oct 2, 2021
@a666 a666 deleted the feature/flakehell branch October 2, 2021 14:56
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

2 participants