-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Refactor depth filtering logic #10200
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10200 +/- ##
=======================================
Coverage 95.84% 95.84%
=======================================
Files 175 175
Lines 19056 19038 -18
=======================================
- Hits 18264 18247 -17
+ Misses 792 791 -1
|
This comment has been minimized.
This comment has been minimized.
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.
Thank you for the merge request ! LGTM, some nits:
Co-authored-by: Pierre Sassoulas <[email protected]>
for more information, see https://pre-commit.ci
Thanks for the review, your suggestions make sense. One thing I noticed when playing around with it. If you call pyreverse for a subpackage and apply a depth limit. For example: pyreverse --max-depth 1 package.subpackage The diagram is correctly generated and starts only at subpackage. However the depth limit is still calculated with respect to the root package. I think it would be more intuitive to calculate depth relative to subpackage in this case. What do you think? |
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 369e19d |
However I am unsure how to achive this given that pyreverse lets you specify multiple packages to analyse |
Yeah hard to reconcile all the arguments. Maybe it's easier to add a warning like "You asked for depth=1 but linked |
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.
Thank you for the refactor! I agree with Pierre, I would go for a warning right now for the case you mentioned.
Thanks for the review and for the suggestion regarding the warning! For properly implementing this warning I would need to implement this in main.py so that I dont have to gather the arguments passed. Maybe it makes more sense to just document this behavior instead? |
Yes, maybe adding a short notice in the help text of the option that explains how the counting works/where it starts would be the best solution for now. |
From experience no one ever read the documentation, so I would favor a warning (unless it's really unreasonable to do it of course). |
I agree with Pierre that documentation is hardly read, so a warning would be much more effective in guiding users. However, to properly detect this edge case, I would need access to the original specified by the user (self.args in main.py) inside DiadefsHandler. Right now, I don’t see a straightforward way to pass this information without modifying the argument flow, but I’ll think about possible solutions. If anyone has suggestions on a clean way to achieve this, I’d be happy to discuss! |
Looked into the argument flow, and changing the structure actually wasn’t too bad, so I implemented depth filtering relative to the shallowest package specified. This keeps submodules grouped under their parent package. However, this introduces inconsistent behavior:
An alternative is to always use the deepest package as the base, ensuring all explicitly listed packages are included (e.g., |
Type of Changes
Description
Refactored the depth filtering logic, as discussed in #10077. Implementation should be much cleaner now :)