Skip to content

Commit

Permalink
Merge pull request #72 from JohnHBrock/add_flake8_config
Browse files Browse the repository at this point in the history
Include .flake8 in config file search
  • Loading branch information
gforcada committed Sep 28, 2019
2 parents 38197cd + d3b209d commit d7a0f10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions README.rst
Expand Up @@ -22,8 +22,10 @@ Install with pip::

Options
-------
Since version 1.0 a check for an ``.isort.cfg`` file is done,
since version 1.1 ``setup.cfg`` is also checked for an ``[isort]`` section.
Config options can be set in several different locations:
* ``.isort.cfg``
* ``.editorconfig``
* an ``[isort]`` section in ``setup.cfg``, ``tox.ini``, or ``.flake8``

This potentially avoids to lint a project that has no formal definition of how import should be sorted.

Expand Down
4 changes: 2 additions & 2 deletions flake8_isort.py
Expand Up @@ -96,7 +96,7 @@ def search_isort_config(self):
"""Search for isort configuration all the way up to the root folder
Looks for ``.isort.cfg``, ``.editorconfig`` or ``[isort]`` section in
``setup.cfg`` or ``tox.ini`` config files.
``setup.cfg``, ``tox.ini``, or ``.flake8`` config files.
"""
full_path = os.path.abspath(self.filename)
split_path = (os.path.dirname(full_path), True)
Expand Down Expand Up @@ -138,7 +138,7 @@ def _search_config_on_path(self, path):
return config_file_path

# Check for '[isort]' section in other configuration files.
for config_file in ('tox.ini', 'setup.cfg'):
for config_file in ('tox.ini', 'setup.cfg', '.flake8'):
config_file_path = os.path.join(path, config_file)
config = SafeConfigParser()
config.read(config_file_path)
Expand Down

0 comments on commit d7a0f10

Please sign in to comment.