Description
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:
class P:
pass
class A:
x: P = P()
class B:
__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.
Command used
pyreverse -o mmd example.py
Pylint output
Generates diagrams with relationships that don't respect the filter mode.
Expected behavior
If an attribute is filtered out due to visibility (private, protected, etc.), its relationship arrow should also be filtered out.
Pylint version
pylint 4.0.0-dev0
astroid 4.0.0a0
Python 3.13.2 (main, Feb 12 2025, 14:49:53) [MSC v.1942 64 bit (AMD64)]