<commit_before>SonarTsPlugin
=============

SonarQube plugin for TypeScript files

[![Build Status](https://travis-ci.org/Pablissimo/SonarTsPlugin.svg?branch=master)](https://travis-ci.org/Pablissimo/SonarTsPlugin)
[![Coverage Status](https://coveralls.io/repos/Pablissimo/SonarTsPlugin/badge.svg?branch=master)](https://coveralls.io/r/Pablissimo/SonarTsPlugin?branch=master)

##Overview

This is a **not even alpha-level yet** SonarQube plugin for analysing projects with TypeScript content that supports:
* TsLint for code quality information
* Importing LCOV files for unit test coverage information
* NCLOC metric generation

It's unfinished in the following respects:
* Plug-in code quality needs improved
* Incomplete unit test coverage of the plugin
* Exceptionally little error handling

It's presented only for the interested, and the brave.

###Breaking change in 0.2###
To more easily support changes to the rules TsLint understands, the plugin no longer generates a TsLint configuration file for you but instead you must now specify your own using the sonar.ts.tslintconfigpath configuration property (either in the web interface, or in your sonar-project.properties file).

##Requirements
* Java 1.7+
* SonarQube 4.4+ (may or may not work with others)
* TsLint 2.4.0+

The plugin has so far *only been tested on Windows* and it'll be no surprise if it fails on Linux just now.

##Building
* Download the source
* Build with maven, *mvn clean && mvn install*

##Installation
* Install Node.js
* Install TsLint (2.4.0+) with *npm install -g tslint*
* Find the path to TsLint and copy it - will be similar to *C:\Users\\[Username]\AppData\Roaming\npm\node_modules\tslint\bin\tslint* on Windows
* Copy .jar file from target/ after build to SonarQube extensions folder
* Restart SonarQube server
* Browse to SonarQube web interface, login as Admin, hit up Settings
* Find the TypeScript tab, paste in the TsLint path
* Hit the Rules tab, then the TsLint rule set, then apply it to your project - alter rule activation as required
* Add *sonar.ts.tslintconfigpath=tslint.json* to your sonar-project.properties file - change the path as required, relative to your properties file
* 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)
* Run sonar-runner
* TsLint rule breaches should be shown in the web view

##Licence
MIT

##Contributors
Thanks to the following for contributions to the plugin:
* [<NAME>](https://github.com/alexkrauss) and [<NAME>](https://github.com/nelo112) for work on improving compatibility with *nix OSes
* [schnee3](https://github.com/schnee3) for giving us some NCLOC support

##With thanks
* The LCOV parser is directly copied from the community JavaScript SonarQube plug-in, which is LGPL'd.
<commit_msg>Updating readme with better configuration option documentation<commit_after>SonarTsPlugin
=============

SonarQube plugin for TypeScript files

[![Build Status](https://travis-ci.org/Pablissimo/SonarTsPlugin.svg?branch=master)](https://travis-ci.org/Pablissimo/SonarTsPlugin)
[![Coverage Status](https://coveralls.io/repos/Pablissimo/SonarTsPlugin/badge.svg?branch=master)](https://coveralls.io/r/Pablissimo/SonarTsPlugin?branch=master)

##Overview

This is a **not even alpha-level yet** SonarQube plugin for analysing projects with TypeScript content that supports:
* TsLint for code quality information
* Importing LCOV files for unit test coverage information
* NCLOC metric generation

It's unfinished in the following respects:
* Plug-in code quality needs improved
* Incomplete unit test coverage of the plugin
* Exceptionally little error handling

It's presented only for the interested, and the brave.

###Breaking change in 0.2###
To more easily support changes to the rules TsLint understands, the plugin no longer generates a TsLint configuration file for you but instead you must now specify your own using the sonar.ts.tslintconfigpath configuration property (either in the web interface, or in your sonar-project.properties file).

##Requirements
* Java 1.7+
* SonarQube 4.4+ (may or may not work with others)
* TsLint 2.4.0+

The plugin has so far *only been tested on Windows* and it'll be no surprise if it fails on Linux just now.

##Building
* Download the source
* Build with maven, *mvn clean && mvn install*

##Installation
* Install Node.js
* Install TsLint (2.4.0+) with *npm install -g tslint*
* Find the path to TsLint and copy it - will be similar to *C:\Users\\[Username]\AppData\Roaming\npm\node_modules\tslint\bin\tslint* on Windows
* Copy .jar file from target/ after build to SonarQube extensions folder
* Restart SonarQube server
* Browse to SonarQube web interface, login as Admin, hit up Settings
* Find the TypeScript tab, paste in the TsLint path
* Hit the Rules tab, then the TsLint rule set, then apply it to your project - alter rule activation as required
* Add *sonar.ts.tslintconfigpath=tslint.json* to your sonar-project.properties file - change the path as required, relative to your properties file
* 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)
* Run sonar-runner
* TsLint rule breaches should be shown in the web view

##Configuration

###Global configuration

<table>
<thead>
<tr><th>Key</th><th></th><th>Description</th></thead>
<tbody>
<tr><td>sonar.ts.tslintpath</td><td><b>Mandatory</b></td><td>Path to the installed copy of TsLint to use</td></tr>
</tbody>
</table>

###Project-level configuration

<table>
<thead>
<tr><th>Key</th><th></th><th>Description</th>
</thead>
<tbody>
<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>
<tr><td>sonar.ts.excludetypedefinitionfiles</td><td><b>Optional</b></td><td>Excludes .d.ts files from analysis</td></tr>
<tr><td>sonar.ts.forceZeroCoverage</td><td><b>Optional</b></td><td>Forces code coverage percentage to zero when no report is supplied</td></tr>
<tr><td>sonar.ts.tslinttimeout</td><td><b>Optional</b></td><td>Max time to wait for TsLint to finish processing a single file (in milliseconds), defaults to 60 seconds</td></tr>
<tr><td>sonar.ts.tslintrulesdir</td><td><b>Optional</b></td><td>Path to a folder containing custom TsLint rules referenced in tslint.json</td></tr>
<tr><td>sonar.ts.lcov.reportpath</td><td><b>Optional</b></td><td>Path to an LCOV code-coverage report to be included in analysis</td></tr>
</tbody>
</table>

##Licence
MIT

##Contributors
Thanks to the following for contributions to the plugin:
* [<NAME>](https://github.com/alexkrauss) and [<NAME>](https://github.com/nelo112) for work on improving compatibility with *nix OSes
* [schnee3](https://github.com/schnee3) for giving us some NCLOC support

##With thanks
* The LCOV parser is directly copied from the community JavaScript SonarQube plug-in, which is LGPL'd.

{'fraction_non_alphanumeric': 0.10970285875228841, 'fraction_numerical': 0.005069708491761723, 'mean_word_length': 5.213473315835521, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 103, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '390962', 'n_tokens_mistral': 2239, 'n_tokens_neox': 2136, 'n_words': 801}