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

Fixes an issue with isort output when pipes (stdin) are uses #69

Merged
merged 4 commits into from
Mar 19, 2019
Merged

Fixes an issue with isort output when pipes (stdin) are uses #69

merged 4 commits into from
Mar 19, 2019

Conversation

maerteijn
Copy link

@maerteijn maerteijn commented Mar 16, 2019

This works:

flake8 my_file.py
my_file.py:4:1: I001 isort found an import in the wrong position

But this doesn't:

cat my_file.py | flake8 -

The latter is used by many editors or linter plugins (including SublimeLinter-flake8).

This patch won't send the filename when stdin is used. It also works with a custom stdin display name:

cat my_file.py | flake8 --stdin-display-name=my_stdin_display_name.py -
my_stdin_display_name.py:4:1: I001 isort found an import in the wrong position

This works with isort>=4.3.0 and flake8>=3.0.0

I also adjusted the travis config not to install this package in editable mode so the tests pass with flake8 3.7.x, see also takluyver/entrypoints#30

Martijn Jacobs added 4 commits March 16, 2019 16:38
The entrypoints package (https://github.com/takluyver/entrypoints/) was introduced in flake8 3.7.

Unfortunately it will detect entrypoints multiple times when the plugin is installed in editable mode
because of this line: https://github.com/takluyver/entrypoints/blob/master/entrypoints.py#L192

The '-' is not in the directory name when you install a package in edit mode so when the python
path contains duplicate paths to the same module flake8 will instantiate the plugin multiple times
as well.
@gforcada
Copy link
Owner

@maerteijn sorry for not replying earlier, yes indeed, I could reproduce your bug and assert that your changes fix it 👍

@gforcada gforcada merged commit 88d6ed0 into gforcada:master Mar 19, 2019
@gforcada
Copy link
Owner

@maerteijn merged and released as 2.7.0! https://pypi.org/project/flake8-isort/

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