File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
lib/semmle/python/dataflow/new/internal Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -2135,8 +2135,18 @@ module DuckTyping {
21352135 /**
21362136 * Holds if `f` overrides a method in a superclass with the same name.
21372137 */
2138- predicate overridesMethod ( Function f ) {
2139- exists ( Class cls | f .getScope ( ) = cls | hasMethod ( getADirectSuperclass ( cls ) , f .getName ( ) ) )
2138+ predicate overridesMethod ( Function f ) { overridesMethod ( f , _, _) }
2139+
2140+ /**
2141+ * Holds if `f` overrides `overridden` declared in `superclass`.
2142+ */
2143+ predicate overridesMethod ( Function f , Class superclass , Function overridden ) {
2144+ exists ( Class cls |
2145+ f .getScope ( ) = cls and
2146+ superclass = getADirectSuperclass + ( cls ) and
2147+ overridden = superclass .getAMethod ( ) and
2148+ overridden .getName ( ) = f .getName ( )
2149+ )
21402150 }
21412151
21422152 /**
Original file line number Diff line number Diff line change @@ -30,9 +30,7 @@ predicate needs_docstring(Scope s) {
3030
3131predicate function_needs_docstring ( FunctionMetrics f ) {
3232 not exists ( Function base |
33- DuckTyping:: overridesMethod ( f ) and
34- base .getScope ( ) = getADirectSuperclass + ( f .getScope ( ) ) and
35- base .getName ( ) = f .getName ( ) and
33+ DuckTyping:: overridesMethod ( f , _, base ) and
3634 not function_needs_docstring ( base )
3735 ) and
3836 f .getName ( ) != "lambda" and
You can’t perform that action at this time.
0 commit comments