Skip to content

[xml] Add new XPath rule for xml#3864

Merged
adangel merged 20 commits into
pmd:masterfrom
oowekyala:xml-new-xpath-rule
Mar 25, 2022
Merged

[xml] Add new XPath rule for xml#3864
adangel merged 20 commits into
pmd:masterfrom
oowekyala:xml-new-xpath-rule

Conversation

@oowekyala

@oowekyala oowekyala commented Mar 19, 2022

Copy link
Copy Markdown
Member

Describe the PR

Not necessarily for PMD 6.44

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)
    • Release notes
    • Maybe language specific doc page for XML
  • Update the designer? It should display the XML tree as a DOM instead of our wrapper.
  • Add a property for default namespace of the rule/ namespace declarations.

We have to reparse the expression with
the correct URI if the input document has
an unnamed URI.
@oowekyala oowekyala linked an issue Mar 19, 2022 that may be closed by this pull request
@ghost

ghost commented Mar 20, 2022

Copy link
Copy Markdown
1 Message
📖 This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report
This changeset changes 86 violations,
introduces 1 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@oowekyala oowekyala changed the title [xml] Add new DOM xpath rule for xml [xml] Add new XPath rule for xml Mar 20, 2022
@oowekyala oowekyala added this to the 6.44.0 milestone Mar 22, 2022
@oowekyala oowekyala force-pushed the xml-new-xpath-rule branch from e0a2c5e to 291be97 Compare March 22, 2022 20:24
@oowekyala oowekyala marked this pull request as ready for review March 24, 2022 12:57
@oowekyala

Copy link
Copy Markdown
Member Author

@adangel I think this is ready for review, the remaining item is to update the release notes, which I'll do tonight

@adangel adangel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good! 🎉

Comment thread docs/_data/xpath_funs.yml
Comment thread docs/_data/xpath_funs.yml
Comment thread docs/pages/pmd/languages/xml.md Outdated
Comment thread pmd-core/src/main/java/net/sourceforge/pmd/lang/xpath/PMDFunctions.java Outdated
oowekyala and others added 2 commits March 24, 2022 19:12
Co-authored-by: Andreas Dangel <andreas.dangel@adangel.org>
@oowekyala oowekyala force-pushed the xml-new-xpath-rule branch from a716884 to 9a43a09 Compare March 24, 2022 18:17
This reverts commit 6e1e8a6.

Note for future: I tried to deprecate the XPath attributes for `@BeginLine`, `@EndLine` etc, but there's a rule I can't port easily without XPath 3: OneDeclarationPerLine. It has this thing:
```
distinct-values(FieldDeclaration/VariableExpression/@BeginLine)
```
In XPath 3 you can write this
```
distinct-values(FieldDeclaration/VariableExpression ! pmd:startLine)
```
But I'm not sure how to do this in XPath 2, so I've reverted the commit,
we can do that later.
@oowekyala

Copy link
Copy Markdown
Member Author

Note for future: I tried to deprecate the XPath attributes for @BeginLine, @EndLine etc, but there's a rule I can't port easily without XPath 3: OneDeclarationPerLine. It has this thing:

distinct-values(FieldDeclaration/VariableExpression/@BeginLine)

In XPath 3 you can write this

distinct-values(FieldDeclaration/VariableExpression ! pmd:startLine)

But I'm not sure how to do this in XPath 2, so I've reverted the commit, we can do that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants