You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 8, 2019. It is now read-only.
*[Running TSLint within SonarQube on a TFS build](http://blogs.blackmarble.co.uk/blogs/rfennell/post/2016/07/05/Running-TSLint-within-SonarQube-on-a-TFS-build) - [Richard Fennell](https://github.com/rfennell)
24
+
21
25
##Overview
22
26
23
27
This is a **not even alpha-level yet** SonarQube plugin for analysing projects with TypeScript content that supports:
@@ -55,7 +59,7 @@ The plugin has so far *only been tested on Windows* and it'll be no surprise if
55
59
* Browse to SonarQube web interface, login as Admin, hit up Settings
56
60
* Find the TypeScript tab, paste in the TsLint path
57
61
* Hit the Rules tab, then the TsLint rule set, then apply it to your project - alter rule activation as required
58
-
*Add *sonar.ts.tslintconfigpath=tslint.json* to your sonar-project.properties file - change the path as required, relative to your properties file
62
+
*Make sure you have a ```tslint.json``` file next to ```sonar-project.properties```, or specify its path using the ```sonar.ts.tslintconfigpath``` setting
59
63
* If LCOV data available, add *sonar.ts.lcov.reportpath=lcov.dat* to your sonar-project.properties file (replace lcov.dat with your lcov output, will be sought relative to the sonar-project.properties file)
60
64
* Run sonar-runner
61
65
* TsLint rule breaches should be shown in the web view
@@ -68,7 +72,7 @@ The plugin has so far *only been tested on Windows* and it'll be no surprise if
<tr><td>sonar.ts.tslintpath</td><td><b>Mandatory</b></td><td>Path to the installed copy of TsLint to use</td></tr>
75
+
<tr><td>sonar.ts.tslintpath</td><td><b>Recommended</b></td><td>Path to the installed copy of TsLint to use - can also be set at project level, see note below</td></tr>
72
76
<tr><td>sonar.ts.ruleconfigs</td><td><b>Optional</b></td><td>A list of configurations to map custom TsLint rules to dedicated SonarQube rules & settings - see TsLint Custom Rules section below</td></tr>
73
77
</tbody>
74
78
</table>
@@ -80,6 +84,7 @@ The plugin has so far *only been tested on Windows* and it'll be no surprise if
80
84
<tr><th>Key</th><th></th><th>Description</th>
81
85
</thead>
82
86
<tbody>
87
+
<tr><td>sonar.ts.tslintpath</td><td><b>Recommended</b></td><td>Path to the installed copy of TsLint to use - see note below</td></tr>
83
88
<tr><td>sonar.ts.tslintconfigpath</td><td><b>Mandatory</b></td><td>Path to the tslint.json file that configures the rules to be used in linting</td></tr>
84
89
<tr><td>sonar.ts.excludetypedefinitionfiles</td><td><b>Optional</b></td><td>Excludes .d.ts files from analysis, defaults to true</td></tr>
85
90
<tr><td>sonar.ts.forceZeroCoverage</td><td><b>Optional</b></td><td>Forces code coverage percentage to zero when no report is supplied, defaults to false</td></tr>
@@ -90,6 +95,13 @@ The plugin has so far *only been tested on Windows* and it'll be no surprise if
90
95
</tbody>
91
96
</table>
92
97
98
+
##TsLint installation and configuration
99
+
By default, SonarTsPlugin will look for a version of TsLint installed locally within your project (i.e. in node_modules\tslint\bin), relative to the sonar-project.properties file. Thismay not be what you want, so you can set this directly via the ```sonar.ts.tslintpath``` configuration setting:
100
+
* At project level
101
+
* Globally, for all projects
102
+
103
+
If analysis is failing, run ```sonar-runner``` with the ```-X -e``` options for more diagnostic information, including a note of where the plugin is searching for ```tslint```. Bear in mind that if running on a build server, the account running the build will need access to the path to ```tslint```.
104
+
93
105
## TsLint Custom Rules
94
106
95
107
To present custom TsLint rules in SonarQube analysis, you can provide a configuration that maps the TsLint rules from your `sonar.ts.tslintrulesdir`
0 commit comments