diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2020-08-22 01:00:19 -0700 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2020-08-22 01:00:19 -0700 |
commit | 8bd4d3f9ae73f3a79fb63cc4baa63123fa739ff5 (patch) | |
tree | 82e3650b9a3a2013556ea4565b218eadb9e26125 | |
parent | ec63f343666ca18fd8efa9fad07438f996da2cf6 (diff) | |
download | isort-8bd4d3f9ae73f3a79fb63cc4baa63123fa739ff5.tar.gz |
Fixed #1399: --skip can error in the case of projects that contain recursive symlinks.
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | isort/main.py | 13 |
2 files changed, 8 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index abcc9b37..4d3ab83a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ NOTE: isort follows the [semver](https://semver.org/) versioning standard. ### 5.5.0 TBD - Fixed #1398: isort: off comment doesn't work, if it's the top comment in the file. - Fixed #1395: reverse_relative setting doesn't have any effect when combined with force_sort_within_sections. - + - Fixed #1399: --skip can error in the case of projects that contain recursive for-loops. + ### 5.4.2 Aug 14, 2020 - Fixed #1383: Known other does not work anymore with .editorconfig. - Fixed: Regression in first known party path expansion. diff --git a/isort/main.py b/isort/main.py index 58c4e101..da912b4c 100644 --- a/isort/main.py +++ b/isort/main.py @@ -115,17 +115,16 @@ def iter_source_code(paths: Iterable[str], config: Config, skipped: List[str]) - base_path = Path(dirpath) for dirname in list(dirnames): full_path = base_path / dirname + resolved_path = full_path.resolve() if config.is_skipped(full_path): skipped.append(dirname) dirnames.remove(dirname) - - resolved_path = full_path.resolve() - if resolved_path in visited_dirs: # pragma: no cover - if not config.quiet: - warn(f"Likely recursive symlink detected to {resolved_path}") - dirnames.remove(dirname) else: - visited_dirs.add(resolved_path) + if resolved_path in visited_dirs: # pragma: no cover + if not config.quiet: + warn(f"Likely recursive symlink detected to {resolved_path}") + dirnames.remove(dirname) + visited_dirs.add(resolved_path) for filename in filenames: filepath = os.path.join(dirpath, filename) |