Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for using javax.xml #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trentbowman
Copy link

This PR adds support for rules which use the standard javax.xml XML libraries instead of jdom2. This directly addresses two issues in the issue tracker (#23, #15) and possibly several others. Benefits include:

  1. Writing one XPath to both find rule-violating nodes (elements, attributes, etc.) and to determine their locations
  2. Multiple violations per rule per file can be tracked and displayed in sonar

Major changes to the plugin include:

  1. Introducing versioning to the rules themselves. Rules that previously existed are implicitly considered 1.0 rules and continue to use the jdom2 code paths and should should work exactly as before. Rules that explicitly declare a version of 1.1 use the javax.xml code paths. This versioning allows users to upgrade the plugin and incrementally move their rules over to 1.1.
  2. Defining a new rule scope called node, and then slightly changing the interpretation of the existing scopes for v1.1 rules:
    • application scope rules must evaluate to true for at least one file, or an issue will be created.
    • file scope rules must evaluate to true or an issue at the file level will be create.
    • node scope rules should select nodes (elements, attributes, comments, etc.) which are not in compliance. An issue will be created for each node returned.
  3. Existing rules in rules-4.xml have been migrated to v1.1
  4. An additional rules file, named rules-4-custom.xml, is loaded. along with the standard rules file. This allows users to write their own built-in rules without needing to change a source file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant