From 2132c79c77e62b0d8bd81ebaa581d767950ec37b Mon Sep 17 00:00:00 2001 From: Piotr Tomiak Date: Mon, 12 Apr 2021 13:45:52 +0200 Subject: [PATCH] Update XSLT and XPath inspections messages. GitOrigin-RevId: d4cb3e4b7d94144d96dd4b08638a61a42c58c354 --- .../inspectionDescriptions/CheckNodeTest.html | 4 +-- .../HardwiredNamespacePrefix.html | 2 +- .../ImplicitTypeConversion.html | 6 ++--- .../IndexZeroUsage.html | 4 +-- .../RedundantTypeConversion.html | 4 +-- .../XsltTemplateInvocation.html | 3 +-- .../XsltVariableShadowing.html | 2 +- .../resources/messages/XPathBundle.properties | 25 ++++++++++--------- .../validation/inspections/CheckNodeTest.java | 16 ++++++------ 9 files changed, 34 insertions(+), 32 deletions(-) diff --git a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/CheckNodeTest.html b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/CheckNodeTest.html index caf7d1775c9f..5fa923126871 100644 --- a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/CheckNodeTest.html +++ b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/CheckNodeTest.html @@ -16,8 +16,8 @@

- This inspection checks whether any element/attribute names that are used in XPath-expressions are actually part of an - associated XML file or are defined in a referenced schema. This helps to avoid problems caused by typos in + Reports any element or attribute names that are used in XPath-expressions, which are not part of an + associated XML file and are not defined in a referenced schema. This helps to avoid problems caused by typos in XPath-expressions that would otherwise occur when running the script and may even then not be recognized immediately.

diff --git a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/HardwiredNamespacePrefix.html b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/HardwiredNamespacePrefix.html index fe62e29c3d14..23ef4813d995 100644 --- a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/HardwiredNamespacePrefix.html +++ b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/HardwiredNamespacePrefix.html @@ -16,7 +16,7 @@

- This inspection checks for comparisons of the name()-function against strings that contain a ":" - which + Reports comparisons of the name() function against strings that contain a ':', which usually indicates a hardwired namespace-prefix in the comparison. Such code will break when run against XML that uses a different prefix for the same namespace.

diff --git a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/ImplicitTypeConversion.html b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/ImplicitTypeConversion.html index 4f5d92f0e011..7aae0fee6dd1 100644 --- a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/ImplicitTypeConversion.html +++ b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/ImplicitTypeConversion.html @@ -16,9 +16,9 @@

- This inspection checks for any implicit conversions between the predefined XPath-types STRING, NUMBER, BOOLEAN and - NODESET. While this is usually not a problem as the conversions are well-defined by the standard, this inspection can - help to write XSLT scripts that are more expressive about types and can even help to avoid subtle bugs: + Reports any implicit conversions between the predefined XPath-types STRING, NUMBER, BOOLEAN + and NODESET. While this is usually not a problem as the conversions are well-defined by the standard, + this inspection can help to write XSLT scripts that are more expressive about types and can even help to avoid subtle bugs:

diff --git a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/IndexZeroUsage.html b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/IndexZeroUsage.html index fb09ffdc774f..9a1033e21544 100644 --- a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/IndexZeroUsage.html +++ b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/IndexZeroUsage.html @@ -16,8 +16,8 @@

- This inspection checks for any accidental use of zero in a predicate index or in a comparision with the function - position(). Such is almost always a bug because in XPath, the index starts at one, not at zero. + Reports accidental usage of zero in a predicate index or in a comparison with the function + position(). Such usage is almost always a bug because in XPath, the index starts at one, not at zero.

diff --git a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/RedundantTypeConversion.html b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/RedundantTypeConversion.html index a85a145c4554..5f9963e46e89 100644 --- a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/RedundantTypeConversion.html +++ b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/RedundantTypeConversion.html @@ -16,8 +16,8 @@

- This inspection checks whether any type-conversion with the functions string(), number() or - boolean() is redundant, i.e. whether the type of argument is the same as the functions return type or if + Reports type-conversions with functions string(), number() or + boolean(), which are redundant. I.e. whether the type of argument is the same as the functions return type or if the expected type of the expression is of type "any". While such an explicit conversion may sometimes be intentional to emphasize the type, this can usually be safely removed.

diff --git a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltTemplateInvocation.html b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltTemplateInvocation.html index fa30675c2af5..dc763ca3eba1 100644 --- a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltTemplateInvocation.html +++ b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltTemplateInvocation.html @@ -16,7 +16,7 @@

- This inspection checks for problems in invocations of named XSLT templates, such as missing arguments, passing + Reports problems in invocations of named XSLT templates, such as missing arguments, passing arguments that are not declared by the template or passing an argument for a certain parameter more than once.

@@ -25,7 +25,6 @@ invocation does not specify an argument for such parameters.

- diff --git a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltVariableShadowing.html b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltVariableShadowing.html index fa86103a7cf1..d8e98d57edb8 100644 --- a/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltVariableShadowing.html +++ b/plugins/xpath/xpath-lang/resources/inspectionDescriptions/XsltVariableShadowing.html @@ -16,7 +16,7 @@

- This inspections checks for shadowed XSLT variables which can lead to possibly undesired effects. + Reports shadowed XSLT variables which can lead to possibly undesired effects.

diff --git a/plugins/xpath/xpath-lang/resources/messages/XPathBundle.properties b/plugins/xpath/xpath-lang/resources/messages/XPathBundle.properties index 66b12c090cdd..5049b65a0430 100644 --- a/plugins/xpath/xpath-lang/resources/messages/XPathBundle.properties +++ b/plugins/xpath/xpath-lang/resources/messages/XPathBundle.properties @@ -101,7 +101,7 @@ dialog.message.cannot.perform.refactoring=Cannot perform refactoring.\n{0} dialog.message.custom.functions.require.prefixed.name=Custom functions require a prefixed name dialog.message.error.in.xpath.expression.for.variable=Error in XPath Expression for Variable ''{0}'': {1} dialog.message.error.while.evaluating.xpath=Error while evaluating XPath:\n{0} -dialog.message.expression.produced=Expression produced +dialog.message.expression.produced=Expression produced dialog.message.function.name=Function name: dialog.message.inline.local.variable=Inline {0} ''{1}''? ({2} local {2, choice, 1#occurrence|1Unknown {0} name {1} +inspection.message.html.unknown.attribute.name.html=Unknown attribute name {0} +inspection.message.html.unknown.element.name.html=Unknown element name {0} inspection.message.illegal.name=Illegal name inspection.message.missing.template.parameter=Missing template parameter: {0} inspection.message.never.used={0} ''{1}'' is never used @@ -179,15 +180,15 @@ inspection.message.undefined.mode=Undefined mode ''{0}'' inspection.message.unknown.type=Unknown type inspection.message.use.of.0.as.predicate.index=Use of 0 as predicate index inspection.message.variable.shadows.variable={0, choice, 0#Parameter|1#Variable} ''{1}'' shadows {2, choice, 0#parameter|1#variable} -inspection.xpath.check.node.test.display.name=Check node test -inspection.xpath.hardwired.namespace.prefix.display.name=Hardwired namespace prefix +inspection.xpath.check.node.test.display.name=Unknown element or attribute name +inspection.xpath.hardwired.namespace.prefix.display.name=Hardcoded namespace prefix inspection.xpath.implicit.type.conversion.display.name=Implicit type conversion -inspection.xpath.index.zero.usage.display.name=Use of index 0 in XPath predicates +inspection.xpath.index.zero.usage.display.name=XPath predicate with index 0 inspection.xpath.redundant.type.conversion.display.name=Redundant type conversion -inspection.xslt.declarations.display.name=Declaration problems -inspection.xslt.template.invocation.display.name=Template invocation problems -inspection.xslt.unused.declaration.display.name=Unused variable/parameter -inspection.xslt.variable.shadowing.display.name=Variable shadowing +inspection.xslt.declarations.display.name=Incorrect declaration +inspection.xslt.template.invocation.display.name=Incorrect template invocation +inspection.xslt.unused.declaration.display.name=Unused variable or parameter +inspection.xslt.variable.shadowing.display.name=Shadowed variable inspections.xpath.group.name=XPath inspections.xslt.group.name=XSLT intention.family.name.add.argument=Add argument @@ -232,10 +233,10 @@ label.classpath.and.jdk=Classpath and JDK: label.disabled=Disabled label.enter.an.xpath.expression=Enter an XPath expression: label.enter.the.prefix.and.uri.of.the.namespace.to.add=Enter the Prefix and URI of the Namespace to add: -label.expression.is.of.type=Expression is of type: +label.expression.is.of.type=Expression is of type: label.highlight.output.as=Highlight output as: label.html.from.hr.center.to.center.html=From
To
-label.name1=&Name: +label.name1=&Name: label.name=Name label.prefix1=&Prefix: label.prefix=Prefix diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/validation/inspections/CheckNodeTest.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/validation/inspections/CheckNodeTest.java index 87847a7d78ea..7089e3d7a655 100644 --- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/validation/inspections/CheckNodeTest.java +++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/validation/inspections/CheckNodeTest.java @@ -89,7 +89,7 @@ public class CheckNodeTest extends XPathInspection { } } if (!found) { - registerProblem(contextProvider, prefixedName, nodeTest, "element"); + registerProblem(contextProvider, prefixedName, nodeTest, false); } } } else if (nodeTest.getPrincipalType() == XPathNodeTest.PrincipalType.ATTRIBUTE) { @@ -103,7 +103,7 @@ public class CheckNodeTest extends XPathInspection { } } if (!found) { - registerProblem(contextProvider, prefixedName, nodeTest, "attribute"); + registerProblem(contextProvider, prefixedName, nodeTest, true); } } } @@ -111,24 +111,26 @@ public class CheckNodeTest extends XPathInspection { } } - private void registerProblem(ContextProvider contextProvider, PrefixedName prefixedName, XPathNodeTest nodeTest, String type) { + private void registerProblem(ContextProvider contextProvider, PrefixedName prefixedName, XPathNodeTest nodeTest, boolean attribute) { final QName qName = contextProvider.getQName(prefixedName, nodeTest); final String name; if (qName != null) { final String pattern; if (!"".equals(qName.getNamespaceURI())) { - pattern = "''{0}'' ({1})"; + pattern = "''{0}'' ({1})"; } else { - pattern = "''{0}''"; + pattern = "''{0}''"; } name = MessageFormat.format(pattern, qName.getLocalPart(), qName.getNamespaceURI()); } else { - name = MessageFormat.format("''{0}''", prefixedName.getLocalName()); + name = MessageFormat.format("''{0}''", prefixedName.getLocalName()); } final LocalQuickFix[] fixes = contextProvider.getQuickFixFactory().createUnknownNodeTestFixes(nodeTest); addProblem(myManager.createProblemDescriptor(nodeTest, - XPathBundle.message("inspection.message.html.unknown.name.html", type, name), + XPathBundle.message(attribute ? "inspection.message.html.unknown.attribute.name.html" + : "inspection.message.html.unknown.element.name.html", + name), myOnTheFly, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING)); }