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

Preserve DOCTYPE in checkstyle.xml #1606

Merged
merged 3 commits into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--
Palantir Baseline Checkstyle configuration.
Authors: Robert Fink, Brian Worth, Merrick Zoubeiri, and many other contributors. Based in part on http://checkstyle.sourceforge.net/google_style.html
Please keep checks alphabetized with one exception: "relaxed" checks are grouped together at the bottom for easier disabling.
Check-specific comments reference documents internal to Palantir and can be safely ignored or removed.
-->
Copy link
Member Author

@pkoenig10 pkoenig10 Jan 7, 2021

Choose a reason for hiding this comment

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

Removed this comment because it didn't write well - it ends up looking like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
    Palantir Baseline Checkstyle configuration.
    Authors: Robert Fink, Brian Worth, Merrick Zoubeiri, and many other contributors. Based in part on http://checkstyle.sourceforge.net/google_style.html
    Please keep checks alphabetized with one exception: "relaxed" checks are grouped together at the bottom for easier disabling.
    Check-specific comments reference documents internal to Palantir and can be safely ignored or removed.
 --><module name="Checker">

This comment isn't particularly useful. In particular, the checks are no longer alphabetized.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer not to make this change in the same PR as a bugfix.

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you opposed to the change? I'm happy to make another PR, but if you're just going to approve that one it seems a bit silly.

I probably should have removed this in #1603.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really have an opinion one way or the other on the comment.


<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public void execute(Task task) {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty(
OutputKeys.DOCTYPE_PUBLIC, document.getDoctype().getPublicId());
transformer.setOutputProperty(
OutputKeys.DOCTYPE_SYSTEM, document.getDoctype().getSystemId());

DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(new FileWriter(checkstyleXml.toFile()));
Expand Down