Workiva / dependency_validator

A tool to help you find missing, under-promoted, over-promoted, and unused dependencies.
Other
56 stars 18 forks source link

Ignore sub-packages #89

Open fzyzcjy opened 2 years ago

fzyzcjy commented 2 years ago

For example:

/mypackage
  ...some code...
  /example
    ...some code...
    pubspec.yaml
  pubspec.yaml

then when considering mypackage, should not consider files in example subpackage

evanweible-wf commented 2 years ago

Personally, I like this idea since we also commonly use nested packages and have to ignore them like so:

# pubspec.yaml
dependency_validator:
  exclude:
    - app/**

My only concern is that this would be inconsistent with how the Dart analyzer works. Right now, if you have a directory structure like the one you outlined, running the analyzer from the root mypackage will also analyze the example subpackage. You have to specify an exclude in analysis_options.yaml to avoid that. In other words, it doesn't really seem like there's precedent for Dart tooling being aware of subpackages and handling them differently than any other subdirectory.

Given that and the fact that this would be a behavioral change that consumers might be relying on, I'm hesitant to introduce this (at least in a minor release). Using the exclude option is at least an easy way to accomplish the same thing. What do you think?

fzyzcjy commented 2 years ago

My only concern is that this would be inconsistent with how the Dart analyzer works. Right now, if you have a directory structure like the one you outlined, running the analyzer from the root mypackage will also analyze the example subpackage. You have to specify an exclude in analysis_options.yaml to avoid that. In other words, it doesn't really seem like there's precedent for Dart tooling being aware of subpackages and handling them differently than any other subdirectory.

The problem is, a dependency in subpackage should not be added to the parent's yaml! So it is indeed a bug.

DanielSmith1239 commented 1 year ago

Hello, would you be able to potentially add an option to easily toggle on/off sub packages without having to explicitly set to exclude each package?