PMD formatter for TSLint

  • 2

PMD formatter for TSLint

One of the development teams we work with is developing in TypeScript and using tslint for code analysis.

We’ve established a CD process for them which involves compiling typsecript to javascript, minifying the resulting code and deploying it to a staging server. Naturally they wanted to run tslint as a part of this flow in order to get notified on any new warnings a commit might have introduced.

When running static code analysis in CD flow one wants some statistics on analysis results and a nice graphic representation of the results. All these are already implemented in the Jenkins PMD plug-in.  (We’ve already used the PMD plugin successfully for representing the OCLint analysis results we run for an iOS project we support.)

So the only thing we needed was formatting the tslint output according to PMD format, which is in fact a very simple xml markup.

Writing a formatter was really easy following the guidelines on tslint README.

And it was already integrated into tslint trunk today (this commit) , so now you can use it for your own project – just use ‘-t pmd’ in oclint CLI.

Continue delivering!





About Author

Anton Weiss

Founding Consultant at Otomato. More than 17 years of industry experience delivering software and building great IT organisations. Passionate about innovation, creativity and freedom of expression.


Giles Roadnight

October 22, 2015 at 2:39 pm

Hi. I was pleased to see this as I want to see a pmd report for my typescript build in jenkins. I seem to have some problems getting it to work though. I have to run it with appendToOutput set to true or the job fails as it tries to write a new file to the same location for every source file. If I set appendToOutput as true I get one output file – but it is badly formed. It has a node for every input file so it cannot be ready by the jenkins pmd plugin.
Is it possible to get around this problem?

Leave a Reply