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
ANN203 does not exist, ANN202 detect protected AND private when it should only detect protected, ANN202 documentation mention private instead of protected.
From flake8-annotations:
ANN202: Missing return type annotation for protected function
ANN203: Missing return type annotation for secret function
Thanks for opening the issue! Based on the PR adding support for flake8-annotations rules, I think this was an intentional choice to combine ANN202 and ANN203. I also think "private" is pretty reasonable for both types. I don't think I've run into the "protected" and "secret" terminology before.
Is this causing you any problems, or is it just a difference from the upstream rule?
Hi.
In a nutshell: Ok for me, this need to be documented but we can close if you want, thanks for answering.
If this is a ruff-specific implementation and design choice, I understand but this should be explicitly stated in documentation.
No issue for me except that it feels weird to go from 202 to 204 without 203 and it is not coherent with flake8-annotations, even if I'm not against "updates" when it makes sense. In this case, to have two rules for annotations, one for protected and one for private doesn't seems very valuable to me.
For protected, that's the one leading underscore attributes or methods that, by convention, should not be accessed from outside of class scope, but still shared to subclasses. You can find here two instances of the word "protected" used here and here.
For "secret", I don't know why they used this wording in the flake8 extension, maybe to explicitly emphasize the difference with conventional OOP private attr.
Summary
ANN203 does not exist, ANN202 detect protected AND private when it should only detect protected, ANN202 documentation mention private instead of protected.
From flake8-annotations:
From Ruff Rules documentation:
Missing return type annotation for private function {name}
From Playground:
Expected detection:
The text was updated successfully, but these errors were encountered: