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

Expose package root to plugins #1691

Closed
PeterJCLaw opened this issue Sep 18, 2022 · 1 comment
Closed

Expose package root to plugins #1691

PeterJCLaw opened this issue Sep 18, 2022 · 1 comment

Comments

@PeterJCLaw
Copy link

describe the request

It would be great if there was a way for plugins to know what the apparent root of a package being linted is. This would be useful mostly for import linters which want to apply rules about where imports can come from, though there may be other uses.

I'll admit I'm not entirely sure what the "correct" way to define the root of a project is (nor what to do for a source tree that contains several independent packages), though these all feel like things that would be best solved centrally rather than by each plugin separately.

#759 miiiight be related here given that that relates to local relative paths, though I can also imagine it being solved separately.

@asottile
Copy link
Member

flake8 doesn't know this information and it isn't determinable statically -- it would have to be a plugin option and supplied explicitly in the case that the import root isn't the project root (otherwise a file option which defaults to . should get the right absolute value)

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

No branches or pull requests

2 participants