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

Change XML output file's version to 1.1 #9607

Closed
DReigada opened this issue Nov 10, 2017 · 23 comments · Fixed by #9667
Closed

Change XML output file's version to 1.1 #9607

DReigada opened this issue Nov 10, 2017 · 23 comments · Fixed by #9667
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion feature This change adds a new feature to ESLint formatter Relates to the formatters bundled with ESLint
Projects

Comments

@DReigada
Copy link
Contributor

What version are you using?
4.7.1 - But this applies to all versions

What did you do?

  1. Have a file with an object like this: var foo = { "\b":42 };
  2. Run eslint with the -f checkstyle flag

What happened?
One of the errors is:
<error line="1" column="18" severity="error" message="Missing space before value for key &apos;&#8;&apos;. (key-spacing)" source="eslint.rules.key-spacing" />

This XML is valid for version 1.1, but the XML header has the version set to 1.0, in which some character references like &#8; are not valid.

What did you expect to happen?

The XML version on the output file should be 1.1

I think this might be related to #6673.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Nov 10, 2017
@platinumazure
Copy link
Member

I'm not saying this is likely, but it's possible some users are depending on us outputting 1.0 right now and so changing to 1.1 could be a breaking change.

Is there a way to solve the entity issue in 1.0, so that we could land that change as a patch and then we could consider outputting 1.1 in a major release (if it is indeed considered a breaking change)?

@platinumazure platinumazure added breaking This change is backwards-incompatible bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion formatter Relates to the formatters bundled with ESLint and removed triage An ESLint team member will look at this issue soon labels Nov 10, 2017
@DReigada
Copy link
Contributor Author

I don't see another way of solving this, since version 1.0 does not support those characters.
Unless those characters are filtered before generating the XML, which can be a problem since that would change the messages' original content.

@not-an-aardvark
Copy link
Member

I'm not very familiar with XML versioning. How would outputting 1.1 be a breaking change?

@platinumazure
Copy link
Member

platinumazure commented Nov 11, 2017

I'm not saying it would be for sure, I was just asking the question.

For humans reading XML, it definitely wouldn't be breaking.

But if the lint output is itself read by some other system, and that system is old and only understands 1.0 semantics and throws if it gets 1.1 XML, then that could inconvenience users, although it's an integration breaking rather than core functionality.

Actually there would be two scenarios depending on whether entities (described in this bug fix) are output:

  • If lint results already include entities, then it's already invalid XML and ether the user's integration is already complaining, or it's handling the invalid output fine. This isn't a breaking change.
  • If a user does not have entities in their XML output, then switching to 1.1 could be a breaking change if their integration outright refuses to read XML 1.1.

I'm more concerned about the second group.

I don't know how realistic this is. In fact, I doubt many users would be affected. But we've put breaking labels on more trivial changes.

@not-an-aardvark
Copy link
Member

I guess we could handle both groups by switching to XML 1.1 only when the output contains entities. But that seems like a hacky workaround.

@platinumazure
Copy link
Member

I'd be okay with maybe accepting this change, and releasing a new formatter with the old behavior (e.g., "xml10") if users complain.

@not-an-aardvark
Copy link
Member

Sounds good to me. Removing the "breaking" label and marking this as accepted.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion and removed breaking This change is backwards-incompatible evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Nov 26, 2017
@Janiczek
Copy link

Just came to chime in that this indeed broke our Jenkins:

12:40:38 ERROR: Step ‘Report Violations’ aborted due to exception: 
12:40:38 org.xmlpull.v1.XmlPullParserException: only 1.0 is supported as <?xml version not '1.1' (position: START_DOCUMENT seen <?xml version="1.1"... @1:19) 

We're currently sed -i-ing the resulting XML report file to change it back to 1.0, but ... yeah, not ideal.

@platinumazure
Copy link
Member

Reopening since we need to revert the PR due to breaking integrations.

I was thinking about this and I think the correct approach is actually to fix the error messages.

If a rule is reporting on an object property such as foo["\b"], it is true that the computed property is using an escape sequence that is unprintable. However, ESLint should represent this error using the text the user typed: In other words, the error message should actually have a literal backslash and then the letter b (or, as a JS string, "\\b").

We can usually abstract this using sourceCode.getText() and other methods on that object, which focus on the parsed source text.

Please elaborate on the lint error (rule, source code, and error message). We should fix the lint message, so that the error message is compatible with XML-based formatters. Thanks!

@platinumazure platinumazure reopened this Nov 30, 2017
@platinumazure platinumazure added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed accepted There is consensus among the team that this change meets the criteria for inclusion labels Nov 30, 2017
@j-f1
Copy link
Contributor

j-f1 commented Nov 30, 2017

Here’s an example in the online demo with U+0008 as part of the message.

@platinumazure
Copy link
Member

platinumazure commented Jan 12, 2018 via email

@not-an-aardvark
Copy link
Member

Making a new formatter also sounds good to me.

@j-f1
Copy link
Contributor

j-f1 commented Jan 12, 2018

What about the opposite — updating the xml formatter and providing a backwards-compatible formatter?

@platinumazure
Copy link
Member

@j-f1

What about the opposite — updating the xml formatter and providing a backwards-compatible formatter?

If done in a major release, that would be fine too.

@platinumazure
Copy link
Member

I'm 👎 to changing the formatter to XML 1.1 without providing an alternative. My preference would be to leave the current formatter alone and create a new one. This would allow us to tackle this outside of a major release, as well-- I'm not sure this necessarily needs to be done in 5.0.

@platinumazure platinumazure added the tsc agenda This issue will be discussed by ESLint's TSC at the next meeting label Mar 29, 2018
@platinumazure
Copy link
Member

TSC Summary: The messages that are part of the current xml formatter output have been identified in some cases as being non-compliant with XML 1.0 standards (having to do with entity encoding, but I can't remember the details). We decided to change the XML version to 1.1, but that broke some people's integrations which could only handle XML 1.0. We could set XML to 1.1 as a breaking change, or we could create a new formatter and thus support both. One possibility that avoids the need for aligning with a major release is to leave the current xml formatter as 1.0 and create an xml11 formatter that outputs as XML 1.1.

TSC Questions:

  • Should we be making a change in the 5.0 release?
  • Should we continue to support XML 1.0 output?
  • Should we support XML 1.1 output?
  • Should we create a new formatter and/or change the existing formatter, and which version should each formatter support?

@alberto
Copy link
Member

alberto commented Apr 2, 2018

I'd vote to add a new formatter and leave the old one as is.

@not-an-aardvark
Copy link
Member

not-an-aardvark commented Apr 12, 2018

In today's TSC meeting, the TSC decided to update the existing xml formatter to support XML 1.1 in a major release, and to add a new xml-1.0 formatter with the legacy behavior.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion tsc agenda This issue will be discussed by ESLint's TSC at the next meeting labels Apr 12, 2018
@alberto alberto added feature This change adds a new feature to ESLint and removed bug ESLint is working incorrectly labels Apr 12, 2018
@not-an-aardvark not-an-aardvark moved this from Needs discussion to Accepted, ready to implement in v5.0.0 Apr 12, 2018
@alberto
Copy link
Member

alberto commented Apr 15, 2018

@eslint/eslint-tsc After having a look at this, we framed the discussion around a non-existent xml formatter. The actual formatters that use xml output are checkstyle, jslint-xml and junit. I am a bit more reluctant to version these according to xml version. I propose we revisit the decision taking this into account.

@alberto alberto added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion tsc agenda This issue will be discussed by ESLint's TSC at the next meeting and removed accepted There is consensus among the team that this change meets the criteria for inclusion labels Apr 15, 2018
@alberto alberto moved this from Accepted, ready to implement to Needs discussion in v5.0.0 Apr 15, 2018
@mysticatea
Copy link
Member

My understanding is:

  1. We update all of checkstyle, jslint-xml and junit to XML 1.1.
  2. We add checkstyle-1.0, jslint-xml-1.0 and junit-1.0 for compatibility. Most people must not care those formatters.

Indeed, *-1.0 may be unnecessary since people can make custom formatters.

@alberto
Copy link
Member

alberto commented Apr 18, 2018

After having a look around, it seems XML 1.1 is not widely adopted, so I'm unsure if we should even make the change or recommend a custom formatter for those who need it.

@not-an-aardvark
Copy link
Member

In today's TSC meeting, the TSC decided to not make any change to existing formatters. Users who need XML 1.1 for their results are encouraged to create a custom formatter.

v5.0.0 automation moved this from Needs discussion to Done Apr 26, 2018
@not-an-aardvark not-an-aardvark removed the tsc agenda This issue will be discussed by ESLint's TSC at the next meeting label Apr 26, 2018
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Oct 24, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Oct 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion feature This change adds a new feature to ESLint formatter Relates to the formatters bundled with ESLint
Projects
No open projects
v5.0.0
  
Done
Development

Successfully merging a pull request may close this issue.

7 participants