-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix Pyreverse: Aggregations aren't filtered according to filter mode (PUB_ONLY, etc.) #10379
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
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 working on this, do you mind addint test using the example givenin the issue please ?
This comment has been minimized.
This comment has been minimized.
I've added the tests using the example from the issue. Please let me know if there's anything else needed. |
Thank you and LGTM @DudeNr33 but I'm having second thought on my classification of the initial issue as a bug. Maybe it's voluntary to still show the link between things ? What do you think ? |
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.
Thanks for the fix! @Pierre-Sassoulas I think it classifies as a bug. I can't say if the original author of the code did this on purpose, but the behavior is at least inconsistent: the name of the attribute is shown on the arrow, but the attribute is not listed in the class itself. I can't think of a reason why this should be the desired behavior.
Therefore it's best labelled as bugfix imo.
@pavan-msys looks like we do not yet have a test in our code base that checks the behavior for the other filter modes. Can you (for completeness) add additional functional checks that cover the other filter-mode
options? You can specify configuration options for the functional tests by supplying a .rc
file next to the test files with the same name. Thank you!
Hi @pavan-msys many thanks for working on this bug. I already started working on this issue a few weeks ago, but I only managed to add tests for all the filter options due to time constraints. If you want I could provide them for you :) |
Hi @Julfried Yes please, that would be very helpful. Thank you! |
I think the easiest way is if you just get them from here: https://github.com/Julfried/pylint/tree/filter-agg |
Hi @Julfried Thanks for sharing the test cases. I have tested them manually, and all are working as expected. Could you please guide me on how to run the test cases using pytest? |
If you have setup your environment according to this guide, you can launch the tests by running this command:
|
for more information, see https://pre-commit.ci
Hi @DudeNr33 As per your suggestion, I have added additional functional checks to cover the other filter mode options. Please let me know if any changes are required. |
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #10379 +/- ##
=======================================
Coverage 95.90% 95.90%
=======================================
Files 176 176
Lines 19126 19130 +4
=======================================
+ Hits 18343 18347 +4
Misses 783 783
π New features to boost your workflow:
|
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit bdfe107 |
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.
Thanks for adding the tests! Good to go now. π
β¦(PUB_ONLY, etc.) (#10379) * updated diagrams.py file * added tests * updated tests * added test cases * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit ed59632)
β¦(PUB_ONLY, etc.) (#10379) (#10401) * updated diagrams.py file * added tests * updated tests * added test cases * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- (cherry picked from commit ed59632) Co-authored-by: pavan-msys <149513767+pavan-msys@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Type of Changes
Description
This PR fixes an issue in Pyreverse where class-level aggregations and associations were not being filtered according to the selected filter mode (PUB_ONLY, ALL, etc.).
Currently, even private or protected attributes result in relationships in the diagram, regardless of the filter setting. This fix ensures that relationships are only created for attributes that match the visibility filter.
Closes #10373