Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Rule definitions are very hard to keep consistent with tslint #17
While trying to update the rule set to newer tslint and applying it for a realistic project, we realized that this is a nightmare in two dimensions:
IMHO, to make this work reliably, we should avoid trying to understand the complete rule metamodel of tslint, and just pass in a pre-existing tslint file (which all projects will have anyway). Ideally, SonarQube would let us generate dynamic rules based on the issues encountered. But the API does not support this, so I guess we must have at least the set of rules pre-configured, but not all the options.
So, to make this work reliably, I'd propose to simplify it:
I think this will make the plugin simpler and much more robust.
What do you think?
However as an experiment I think you're right that it's not gone too well, and a lack of control over the TsLint version in use means the whole thing's a moveable feast. I think the C# plugin (the only other 'core' one I can think of that has external dependencies) gets away with it a bit easier as FxCop's a slower-moving target but don't know if there's anything else to learn from how they deal with this.
I understand the reasoning why SonarQube folks try to do their own thing instead of depending on other projects, but I don't think this approach can work for more than a few major languages. Until typescript has become becomes the undisputed lingua franca for the web, noone is going to write and maintain a decent linter that is tightly coupled to Sonar. Instead, integrating standard stuff is what works.
Working on that... will come with a PR soon, once we got this running.
Just for giggles and after the best part of a bottle of a particularly cheeky Cabernet Sauvignon I had a bash at this in the issue17 branch. It's in need of unit testing (and more interactive testing) but what I have aimed to do is as follows:
It'll be a breaking change for any project using it as I've not yet added a default to use in the event a file isn't specified, but if you fancy cloning, building and having a bash we can see if it covers the bases you're after.
Would probably take a
referenced this issue
Feb 24, 2017
The easiest way to get an example tslint.json is to run
Alternatively you can use the file at the