mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Remove PyStringExceptionInspection and PyWrapInExceptionQuickFix as no longer relevant for supported python versions
GitOrigin-RevId: 9718219e670d2fe0a8e7c710f9c789c9b8f25dd9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c8af780230
commit
1f898d43af
@@ -164,7 +164,6 @@
|
||||
<localInspection language="Python" shortName="PyExceptionInheritInspection" suppressId="PyExceptionInherit" bundle="messages.PyPsiBundle" key="INSP.NAME.exception.not.inherit" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyExceptionInheritInspection"/>
|
||||
<localInspection language="Python" shortName="PyUnboundLocalVariableInspection" suppressId="PyUnboundLocalVariable" bundle="messages.PyPsiBundle" key="INSP.NAME.unbound" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyUnboundLocalVariableInspection"/>
|
||||
<localInspection language="Python" shortName="PyStatementEffectInspection" suppressId="PyStatementEffect" bundle="messages.PyPsiBundle" key="INSP.NAME.statement.effect" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyStatementEffectInspection"/>
|
||||
<localInspection language="Python" shortName="PyStringExceptionInspection" suppressId="PyStringException" bundle="messages.PyPsiBundle" key="INSP.NAME.raising.string.exception" groupKey="INSP.GROUP.python" enabledByDefault="true" level="ERROR" implementationClass="com.jetbrains.python.inspections.PyStringExceptionInspection"/>
|
||||
<localInspection language="Python" shortName="PySuperArgumentsInspection" suppressId="PySuperArguments" bundle="messages.PyPsiBundle" key="INSP.NAME.wrong.super.arguments" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PySuperArgumentsInspection"/>
|
||||
<localInspection language="Python" shortName="PyNonAsciiCharInspection" suppressId="PyNonAsciiChar" bundle="messages.PyPsiBundle" key="INSP.NAME.non.ascii" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyNonAsciiCharInspection"/>
|
||||
<localInspection language="Python" shortName="PyTupleItemAssignmentInspection" suppressId="PyTupleItemAssignment" bundle="messages.PyPsiBundle" key="INSP.NAME.tuple.item.assignment" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyTupleItemAssignmentInspection"/>
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection detects when a string exception is raised.
|
||||
</body>
|
||||
</html>
|
||||
@@ -344,7 +344,6 @@ QFIX.remove.trailing.semicolon=Remove trailing semicolon
|
||||
QFIX.introduce.variable=Introduce variable for statement
|
||||
QFIX.NAME.make.list=Replace tuple with list
|
||||
QFIX.NAME.add.specifier=Add format specifier character
|
||||
QFIX.NAME.wrap.in.exception=Wrap with Exception call
|
||||
QFIX.add.global=Add global statement
|
||||
QFIX.create.property=Create property
|
||||
QFIX.add.property=Add property for the field
|
||||
@@ -462,7 +461,6 @@ INSP.abstract.class.add.to.superclasses=Add ''{0}'' to superclasses
|
||||
INSP.named.tuple=Namedtuple definition
|
||||
INSP.shadows.name.from.outer.scope=Shadows name ''{0}'' from outer scope
|
||||
INSP.trailing.semicolon=Trailing semicolon in the statement
|
||||
INSP.raising.string.exception=Raising a string exception
|
||||
INSP.protected.member.ignore.annotations=Ignore annotations
|
||||
INSP.protected.member.ignore.test.functions=Ignore test functions
|
||||
INSP.docstring.types.fix.docstring=Fix docstring
|
||||
@@ -626,9 +624,6 @@ INSP.NAME.statement.effect=Statement has no effect
|
||||
INSP.statement.effect.statement.seems.to.have.no.effect=Statement seems to have no effect
|
||||
INSP.statement.effect.statement.having.no.effect.can.be.replaced.with.function.call=Statement seems to have no effect and can be replaced with a function call to have effect
|
||||
|
||||
# PyStringExceptionInspection
|
||||
INSP.NAME.raising.string.exception=Raising a string exception
|
||||
|
||||
# PySuperArgumentsInspection
|
||||
INSP.NAME.wrong.super.arguments=Wrong arguments to call super
|
||||
INSP.class.is.not.subtype.of.class=''{0}'' is not an instance or a subclass of ''{1}''
|
||||
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.inspections;
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionToolSession;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.jetbrains.python.PyPsiBundle;
|
||||
import com.jetbrains.python.inspections.quickfix.PyWrapInExceptionQuickFix;
|
||||
import com.jetbrains.python.psi.PyExpression;
|
||||
import com.jetbrains.python.psi.PyRaiseStatement;
|
||||
import com.jetbrains.python.psi.PyStringLiteralExpression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Alexey.Ivanov
|
||||
*/
|
||||
public class PyStringExceptionInspection extends PyInspection {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
|
||||
boolean isOnTheFly,
|
||||
@NotNull LocalInspectionToolSession session) {
|
||||
return new Visitor(holder, session);
|
||||
}
|
||||
|
||||
private static class Visitor extends PyInspectionVisitor {
|
||||
Visitor(@Nullable ProblemsHolder holder, @NotNull LocalInspectionToolSession session) {
|
||||
super(holder, session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPyRaiseStatement(@NotNull PyRaiseStatement node) {
|
||||
PyExpression[] expressions = node.getExpressions();
|
||||
if (expressions.length > 0) {
|
||||
PyExpression expression = expressions[0];
|
||||
if (expression instanceof PyStringLiteralExpression) {
|
||||
registerProblem(expression, PyPsiBundle.message("INSP.raising.string.exception"), new PyWrapInExceptionQuickFix());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.inspections.quickfix;
|
||||
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.PyPsiBundle;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PyWrapInExceptionQuickFix implements LocalQuickFix {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return PyPsiBundle.message("QFIX.NAME.wrap.in.exception");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final PsiElement string = descriptor.getPsiElement();
|
||||
if (string instanceof PyStringLiteralExpression) {
|
||||
final PyCallExpression callExpression =
|
||||
PyElementGenerator.getInstance(project).createCallExpression(LanguageLevel.forElement(string), "Exception");
|
||||
final PyArgumentList list = callExpression.getArgumentList();
|
||||
assert list != null;
|
||||
list.addArgument((PyExpression)string);
|
||||
string.replace(callExpression);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>test.py</file>
|
||||
<line>1</line>
|
||||
<description>Raising a string exception</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -1,2 +0,0 @@
|
||||
raise "exception"
|
||||
raise Exception()
|
||||
@@ -1,2 +0,0 @@
|
||||
def foo():
|
||||
raise <error descr="Raising a string exception">"String"<caret> "String1"</error>
|
||||
@@ -1,2 +0,0 @@
|
||||
def foo():
|
||||
raise Exception("String" "String1")
|
||||
@@ -1 +0,0 @@
|
||||
raise <error descr="Raising a string exception">"Some<caret> String"</error>
|
||||
@@ -1 +0,0 @@
|
||||
raise Exception("Some String")
|
||||
@@ -137,11 +137,6 @@ public class PythonInspectionsTest extends PyTestCase {
|
||||
doTest(getTestName(false), inspection);
|
||||
}
|
||||
|
||||
public void testPyStringExceptionInspection() {
|
||||
LocalInspectionTool inspection = new PyStringExceptionInspection();
|
||||
doTest(getTestName(false), inspection);
|
||||
}
|
||||
|
||||
public void testPySuperArgumentsInspection() {
|
||||
LocalInspectionTool inspection = new PySuperArgumentsInspection();
|
||||
doTest(getTestName(false), inspection);
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.quickFixes;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import com.jetbrains.python.PyPsiBundle;
|
||||
import com.jetbrains.python.PyQuickFixTestCase;
|
||||
import com.jetbrains.python.inspections.PyStringExceptionInspection;
|
||||
|
||||
@TestDataPath("$CONTENT_ROOT/../testData/quickFixes/PyWrapInExceptionQuickFixTest/")
|
||||
public class PyWrapInExceptionQuickFixTest extends PyQuickFixTestCase {
|
||||
|
||||
public void testSimple() {
|
||||
doQuickFixTest(PyStringExceptionInspection.class, PyPsiBundle.message("QFIX.NAME.wrap.in.exception"));
|
||||
}
|
||||
|
||||
public void testInFunction() {
|
||||
doQuickFixTest(PyStringExceptionInspection.class, PyPsiBundle.message("QFIX.NAME.wrap.in.exception"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user