void (@NotNull PyFunction node) { if (isBuiltin(node)) return; final PyClass containingClass = node.getContainingClass(); if (containingClass == null) return; final PsiElement firstSuper = PySuperMethodsSearch.search(node, myTypeEvalContext).findFirst(); if (firstSuper != null) return; final PyFunction firstOverride = PyOverridingMethodsSearch.search(node, true).findFirst(); if (firstOverride != null) return; final PyDecoratorList decoratorList = node.getDecoratorList(); if (decoratorList != null) return; if (node.getModifier() != null) return; final Property property = containingClass.findPropertyByCallable(node); if (property != null) return; final List<PyAssignmentStatement> attributes = node.findAttributes(); if (!attributes.isEmpty()) return; if (isTestElement(node)) return; if (PyUtil.isEmptyFunction(node)) return; final PyParameter[] parameters = node.getParameterList().getParameters(); final String selfName; if (parameters.length > 0) { final String name = parameters[0].getName(); selfName = name != null ? name : parameters[0].getText(); } else { selfName = PyNames.CANONICAL_SELF; } final boolean[] mayBeStatic = {true}; PyRecursiveElementVisitor visitor = new PyRecursiveElementVisitor() { @Override public void visitPyRaiseStatement(@NotNull PyRaiseStatement node) { super.visitPyRaiseStatement(node); final PyExpression[] expressions = node.getExpressions(); if (expressions.length == 1) { final PyExpression expression = expressions[0]; if (expression instanceof PyCallExpression) { final PyExpression callee = ((PyCallExpression)expression).getCallee(); if (callee != null && PyNames.NOT_IMPLEMENTED_ERROR.equals(callee.getText())) mayBeStatic[0] = false; } else if (PyNames.NOT_IMPLEMENTED_ERROR.equals(expression.getText())) { mayBeStatic[0] = false; } } } @Override public void visitPyReferenceExpression(@NotNull PyReferenceExpression node) { if (node.isQualified()) { super.visitPyReferenceExpression(node); } else if (selfName.equals(node.getName())) { mayBeStatic[0] = false; } } @Override public void visitPyCallExpression(@NotNull PyCallExpression node) { super.visitPyCallExpression(node); if (!LanguageLevel.forElement(node).isPython2() && node.isCalleeText(PyNames.SUPER)) { mayBeStatic[0] = false; } } }; node.accept(visitor); final PsiElement identifier = node.getNameIdentifier(); if (mayBeStatic[0] && identifier != null) { registerProblem(identifier, PyPsiBundle.message("INSP.method.may.be.static"), ProblemHighlightType.WEAK_WARNING, null, new PyMakeMethodStaticQuickFix(), new PyMakeFunctionFromMethodQuickFix()); } }