Python: Fix all metrics-related compilation failures

In hindsight, having a `.getMetrics()` method that just returns `this`
is somewhat weird. It's possible that it predates the existence of the
inline cast, however.
This commit is contained in:
Taus
2025-11-26 17:03:03 +00:00
parent c75329d7b7
commit 24a29f46be
34 changed files with 82 additions and 51 deletions

View File

@@ -28,12 +28,12 @@ predicate needs_docstring(Scope s) {
)
}
predicate function_needs_docstring(Function f) {
predicate function_needs_docstring(FunctionMetrics f) {
not exists(FunctionValue fo, FunctionValue base | fo.overrides(base) and fo.getScope() = f |
not function_needs_docstring(base.getScope())
) and
f.getName() != "lambda" and
(f.getMetrics().getNumberOfLinesOfCode() - count(f.getADecorator())) > 2 and
(f.getNumberOfLinesOfCode() - count(f.getADecorator())) > 2 and
not exists(PythonPropertyObject p |
p.getGetter().getFunction() = f or
p.getSetter().getFunction() = f