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

Apply XML Code Style #28

Open
stephen-smith opened this issue Jun 18, 2019 · 1 comment
Open

Apply XML Code Style #28

stephen-smith opened this issue Jun 18, 2019 · 1 comment

Comments

@stephen-smith
Copy link

http://maven.apache.org/developers/conventions/code.html#XML_Code_Style

Tidy currently applies the "POM Code Convention". However since pom.xml files are also XML, the "XML Code Style" should also be applied. In particular, tabs should not be used, and indentation is mostly 2-spaces, with 4-space "hanging" indents for long opening tags (many attributes). Line breaks are also required in many places -- all complex XML types -- and forbidden in a few -- simple XML types.

While it is possible that some projects would prefer to follow the "POM Code Convention" without the "XML Code Style"; they are likely to be rare. In any case, it would be a nice option for tidy-maven-plugin to also apply the XML Code Style, either by default or at least when explicitly requested, either via a new goal or configuration of the existing check/pom goals.

May be a duplicate of #18

@paulwwisl
Copy link

I was looking to create ticket to "format xml", but this ticket already started topic.

http://maven.apache.org/developers/conventions/code.html#XML_Code_Style is new for me,
and I would disagree about 2-spaces for indent in pom.xml.
In fact I never seen such pom.xml files.
I remember Eclipse xml formatting was using 4 spaces. But that would come from general configuration for tab indent.
So that is other topic of using .editorconfig files https://editorconfig.org/

Important XML formating should be separate goal like tidy:xml

P.S. just discovered that https://github.com/ec4j/editorconfig-maven-plugin can do xml formating,
so it can be actually used for pom.xml, and so this ticket can be resolved just to use external tools, possibly reference them.

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

No branches or pull requests

3 participants