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

Checkstyle formatter does not include error free files. #3837

Closed
mastermatt opened this issue Apr 16, 2018 · 2 comments
Closed

Checkstyle formatter does not include error free files. #3837

mastermatt opened this issue Apr 16, 2018 · 2 comments

Comments

@mastermatt
Copy link
Contributor

Bug Report

  • TSLint version: 5.9.1
  • TypeScript version: 2.8.1
  • Running TSLint via: CLI

TypeScript code being linted

// error free code

with tslint.json configuration:

{
    "extends": [
        "tslint:recommended"
    ]
}

tslint --project . --format checkstyle index.ts

Actual behavior (newlines added for readability)

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

Expected behavior

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="/path/to/src/index.ts"></file>
</checkstyle>

As noted in #250, this file is the closest thing to an official spec on the format.
The relevant bit is that writeFileMessages writes a tag for each file linted. Errorless files are just empty tags.
As I'm finding out, some parsers need those tags. Otherwise they return an error message stating no lint checks were preformed and/or they allows show 100% of files have issues.

I opted to open an issue on this instead of submitting a PR as I'm unsure of the preferred way to handle this. The Linter class doesn't store all the files it lints and therefore can't pass them to the formatter in getResults() as is. One option would be to just add each file in turn in lint(), then add a third arg to IFormatter.format.

@mastermatt
Copy link
Contributor Author

Seems related to #3744

mastermatt added a commit to mastermatt/tslint that referenced this issue Apr 17, 2018
For palantir#3837, allows the Checkstyle and JUnit formatters to output the
files that did not have any failures.

Adding a third argument to `IFormatter.format` seems like a more
reasonable option than changing its signature and having a breaking
change.
mastermatt added a commit to mastermatt/tslint that referenced this issue May 7, 2018
For palantir#3837, allows the Checkstyle and JUnit formatters to output the
files that did not have any failures.

Adding a third argument to `IFormatter.format` seems like a more
reasonable option than changing its signature and having a breaking
change.
mastermatt added a commit to mastermatt/tslint that referenced this issue Oct 26, 2018
For palantir#3837, allows the Checkstyle and JUnit formatters to output the
files that did not have any failures.

Adding a third argument to `IFormatter.format` seems like a more
reasonable option than changing its signature and having a breaking
change.
mastermatt added a commit to mastermatt/tslint that referenced this issue Oct 26, 2018
For palantir#3837, allows the Checkstyle and JUnit formatters to output the
files that did not have any failures.

Adding a third argument to `IFormatter.format` seems like a more
reasonable option than changing its signature and having a breaking
change.
mastermatt added a commit to mastermatt/tslint that referenced this issue Nov 30, 2018
For palantir#3837, allows the Checkstyle and JUnit formatters to output the
files that did not have any failures.

Adding a third argument to `IFormatter.format` seems like a more
reasonable option than changing its signature and having a breaking
change.
@mastermatt
Copy link
Contributor Author

This was resolved with #3838

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

3 participants