Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Empty xml report with checkstyle #1353

Closed
Quantumplation opened this issue Jun 28, 2016 · 9 comments
Closed

Empty xml report with checkstyle #1353

Quantumplation opened this issue Jun 28, 2016 · 9 comments

Comments

@Quantumplation
Copy link

Bug Report

  • TSLint version: 3.11.0
  • TypeScript version: 1.8.10
  • Running TSLint via: CLI
./node_modules/.bin/tslint src/**/*.ts --exclude **/*-spec.ts -o ./_lint/report.xml -t checkstyle

Actual behavior

File report.xml is created, but is empty

Expected behavior

File report.xml should have contents, something like:

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
</checkstyle>

My build server fails because the produced file is invalid XML

@adidahiya
Copy link
Contributor

adidahiya commented Jun 28, 2016

Do you get any failures reported with other formatters? Try quoting your globs in the CLI ('src/**/*.ts', etc.). If the linter is getting files and reporting zero failures but not outputting any XML, this sounds like a bug (see these tests).

@Quantumplation
Copy link
Author

Quantumplation commented Jun 28, 2016

If I introduce a linting violation, the command (unchanged) produces a valid checkstyle xml file, it's only when there are no linting errors in the project.

EDIT: Just checked, quoting my globs doesn't fix the issue.

@caugner
Copy link
Contributor

caugner commented Aug 3, 2016

Same problem and expectation (cf. initial comment) here.

@jkillian
Copy link
Contributor

jkillian commented Aug 7, 2016

This seems like a general TSLint w/ regards to formatters and not just an issue with the checkstyle one. If there are no violations, nothing gets written to stdout.

I'm not sure why this is the current behavior, I'm up for changing this unless anyone can think of a reason why it's better as it is now.

@caugner
Copy link
Contributor

caugner commented Aug 7, 2016

I'm up for changing this unless anyone can think of a reason why it's better as it is now.

I agree with this change, because the current behavior makes the wrong assumption that formatters don't need to emit anything on success.

It should be noted that custom formatters could potentially make use of this assumption and report a failure even on success (e.g. if the reporter prints "There were N failures: (...)" and CI checks for the string There were [0-9]+ failures). As this is only a hypothetical problem and the included standard formatters are not affected by this, it should suffice to note this in the release notes, so that users with this issue have a higher chance of quickly resolving it.

@caugner
Copy link
Contributor

caugner commented Aug 7, 2016

This issue also affects the pmd reporter.

@jkillian
Copy link
Contributor

jkillian commented Aug 8, 2016

The exit status code provides a better way to indicate success/failure that the textual output of a formatter anyways. I'd say that the current behavior is broken, so let's fix this!

@Quantumplation
Copy link
Author

Any update on this?

@jkillian
Copy link
Contributor

jkillian commented Sep 1, 2016

This will be addressed by #1472 and will be fixed in the next release of TSLint

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

No branches or pull requests

4 participants