import-linter icon indicating copy to clipboard operation
import-linter copied to clipboard

Feature request: minimum imports

Open sbrugman opened this issue 1 year ago • 2 comments

Prematurely generalization by moving functions to different modules (e.g. common, utils) can lead to a convoluted codebases. This can lead to global chaos, especially in mono-repos.

It would be interesting to be able to require a minimum number of imports between certain modules, for instance, utility functions at the top level of the module need to be imported by at least two submodules. (Two+ links in the import graph)

(If you think in terms of number of links, then forbidden is just the special case where max=0)

sbrugman avatar Feb 23 '24 16:02 sbrugman

Interesting idea! So are you thinking this would be a new contract type?

One option for this would be to implement it as a custom contract to begin with. It could even be published as its own PyPI package and have a different maintainer, if someone is interested.

seddonym avatar Feb 26 '24 10:02 seddonym