mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-32472: Skip "unused" inspection for Django implicit contract signatures
User may have View.get method with unused parameters, which are, however, required.
This commit is contained in:
@@ -32,5 +32,6 @@
|
||||
<orderEntry type="library" name="netty-handler" level="project" />
|
||||
<orderEntry type="library" name="netty-codec-http" level="project" />
|
||||
<orderEntry type="library" name="jsoup" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.extensions" scope="PROVIDED" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -669,6 +669,7 @@
|
||||
</extensions>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="Pythonid.skipUnusedLocal" interface="com.jetbrains.python.inspections.PyUnusedLocalInspectionSkipper"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyReferenceCustomTargetChecker" interface="com.jetbrains.python.psi.impl.references.PyReferenceCustomTargetChecker"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyTestFixtureExtension" interface="com.jetbrains.python.testing.pyTestFixtures.PyTestFixtureExtension"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyTestConfigurationSelector" interface="com.jetbrains.python.testing.PyTestConfigurationSelector"/>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.inspections
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import com.jetbrains.python.psi.PyFunction
|
||||
import com.jetbrains.python.psi.types.TypeEvalContext
|
||||
|
||||
interface PyUnusedLocalInspectionSkipper {
|
||||
fun skip(element: PyFunction, context: TypeEvalContext): Boolean
|
||||
|
||||
companion object {
|
||||
fun skip(element: PyFunction,
|
||||
context: TypeEvalContext) = EP.extensions.any { it.skip(element, context) }
|
||||
val EP = ExtensionPointName.create<PyUnusedLocalInspectionSkipper>("Pythonid.skipUnusedLocal")
|
||||
}
|
||||
}
|
||||
@@ -67,8 +67,8 @@ public class PyUnusedLocalInspectionVisitor extends PyInspectionVisitor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPyFunction(final PyFunction node) {
|
||||
if (!PyiUtil.isOverload(node, myTypeEvalContext)) {
|
||||
public void visitPyFunction(@NotNull final PyFunction node) {
|
||||
if (!PyiUtil.isOverload(node, myTypeEvalContext) && !PyUnusedLocalInspectionSkipper.Companion.skip(node, myTypeEvalContext)) {
|
||||
processScope(node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user