-
-
Notifications
You must be signed in to change notification settings - Fork 288
Dep tracking filtering #1241
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
Dep tracking filtering #1241
Conversation
scala/scala_toolchain.bzl
Outdated
|
|
||
| all_strict_deps_patterns = ctx.attr.dependency_tracking_strict_deps_patterns | ||
|
|
||
| strict_deps_include_patterns = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extract a function to partition patterns into include/exclude lists
| return ctx.toolchains["@io_bazel_rules_scala//scala:toolchain_type"].unused_dependency_checker_mode | ||
|
|
||
| def _is_target_included(target, includes, excludes): | ||
| if len([exclude for exclude in excludes if target.startswith(exclude)]) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of building list and checking length you could use loop with an if? For example
for exclude in excludes:
if target.startswith(exclude):
return False
Or maybe if any([target.startswith(exclude) for exclude in excludes]) but I guess you would building new list each time however it might not be an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards simple loop
simuons
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just couple minor comments/suggestions.
* Add target prefix filters support for strict/unused deps * Add dependecy tracking filtering docs * Remove todo comment * Extract deps pattern partition function, optimize pattern macthing
Implements #1240