Skip to content

ng lint problems with formatted output #4849

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

Closed
moritz-h opened this issue Feb 20, 2017 · 2 comments
Closed

ng lint problems with formatted output #4849

moritz-h opened this issue Feb 20, 2017 · 2 comments

Comments

@moritz-h
Copy link
Contributor

moritz-h commented Feb 20, 2017

OS?

Ubuntu 16.04

Versions.

@angular/cli: 1.0.0-beta.32.3
node: 6.9.5
os: linux x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.32.3
@angular/compiler-cli: 2.4.8

Repro steps.

ng new cli-project
add some lint errors (i added spaces to src/main.ts)
ng lint --format pmd
ng lint --format checkstyle

The log given by the failure.

Output for pmd:

<pmd version="tslint">
  <file name="src/main.ts">
    <violation begincolumn="26" beginline="1" priority="1" rule="Too many spaces before &#39;from&#39;"> </violation>
  </file>
</pmd>
<pmd version="tslint"></pmd>

Error is extra <pmd version="tslint"></pmd> at the end.

Output for checkstyle:

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
  <file name="src/main.ts">
    <error line="1" column="26" severity="warning" message="Too many spaces before &#39;from&#39;" source="failure.tslint.import-spacing" />
  </file>
</checkstyle>
<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3"></checkstyle>

Error is extra <?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"></checkstyle> at the end.

Mention any other details that might be useful.

Edit: I looked through the code and found the source of the error:
In .angular-cli.json multiple lintConfigs could be defined (by default 2):
https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/blueprints/ng2/files/angular-cli.json#L37-L44

Here a new linter instance is created within the foreach loop of the lintConfigs:
https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/tasks/lint.ts#L40-L48

So each new instance adds a new header for the output file. This is no problem for normal text output, but for XML output it crashes the result.

And unfortunately the creation of a new linter depends on the lintConfigs, otherwise i could have made a simple pull request just moving the linter creation outside the loop.


Thanks! We'll be in touch soon.

@moritz-h
Copy link
Contributor Author

Is fixed now: c99cf96

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant