You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Pyreverse with filter modes like PUB_ONLY, relationships between classes (arrows in diagrams) are still shown even when the attributes themselves are filtered out due to visibility settings.
For example, with this code:
classP:
passclassA:
x: P=P()
classB:
__x: P=P()
And running with default settings (PUB_ONLY), the diagram shows:
classDiagram
class A {
x
}
class B {
}
class P {
}
P --* A : x
P --* B : __x
Now __x is correctly filtered out from class B's attributes due to being private, but the relationship arrow P --* B : __x is still displayed.
When using --filter-mode=ALL, both attributes and relationships are shown correctly:
classDiagram
class A {
x
}
class B {
__x
}
class P {
}
P --* A : x
P --* B : __x
The relationships (arrows) should be filtered according to the same visibility rules as attributes for consistency.
I’m working on a fix for the issue where aggregations and associations aren’t being filtered according to the selected filter mode (PUB_ONLY, ALL, etc.) in Pyreverse.
To fix this, I added a check in the extract_relationships() method to filter out aggregations and associations based on visibility before adding them to the diagram. I used self.show_attr(name) to handle this filtering.
Before I submit a PR, I wanted to check if this is the right approach. Does this look good, or is there something else I should consider for filtering these relationships based on the filter mode?
Bug description
When using Pyreverse with filter modes like PUB_ONLY, relationships between classes (arrows in diagrams) are still shown even when the attributes themselves are filtered out due to visibility settings.
For example, with this code:
And running with default settings (PUB_ONLY), the diagram shows:
Now __x is correctly filtered out from class B's attributes due to being private, but the relationship arrow P --* B : __x is still displayed.
When using --filter-mode=ALL, both attributes and relationships are shown correctly:
The relationships (arrows) should be filtered according to the same visibility rules as attributes for consistency.
Command used
Pylint output
Expected behavior
If an attribute is filtered out due to visibility (private, protected, etc.), its relationship arrow should also be filtered out.
Pylint version
The text was updated successfully, but these errors were encountered: