Always ignore symlinks that point outside of the current VCS project
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 687
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 2
Description
#1772 fixed errors from trying to ask git about files outside its knowledge by ignoring these kind of external links, but did not stop isort from continuing to follow, and possibly edit, these files.
I think that when users have these kind of links, they don't expect them to be followed. Symlinks that point within the same project should probably continue to be followed. This has already been an issue to users running either the Spack package manager or the Bazel build tool.
This would also help in aligning running isort with black. Since black never follows these sorts of links, a project that had them and wanted isort to check the same files would have to pass each link as an extra ignore path in addition to those being kept in sync with black.
To properly make this change universally I think there are multiple places isort will have to look for links and check if they are external or internal. At least files.py but also main.py and api.py; it partially depends on if isort should support following an external link if it is explicitly passed in by the user. Additionally, the check for links in _check_folder_gitignore() is probably not needed once this is a default check on all paths.
Also, some food for thought, black will ignore any file that is on the other side of a symlink that points outside of the project's root. It might be good for isort to take the same line and always ignore these sorts of files.
isort does have an older userbase, and works in more than just git repositories, so this might break some workflows though.
Originally posted by @ucodery in https://github.com/PyCQA/isort/issues/1772#issuecomment-873826801
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing symlink handling in files.py, main.py, and api.py, including _check_folder_gitignore(). Compare how paths are handled when links point inside versus outside the project, and clarify the behavior for explicitly passed external links. Done means external symlinks are consistently ignored without changing the handling of internal links.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100