Skip to content

Commit

Permalink
Merged release/3.1.0 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinGot committed Dec 19, 2016
2 parents c4d8390 + da57179 commit f04e57f
Show file tree
Hide file tree
Showing 49 changed files with 512 additions and 139 deletions.
2 changes: 1 addition & 1 deletion .sreporterrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"rulesFile": "./samples/.csslintrc"
},
"eslint": {
"src": "./samples/src/**/*.js",
"src": [ "samples/src/**/*.js", "!samples/src/bower_components/**" ],
"report": "reports/sonar/eslint.json",
"rulesFile": "./samples/.eslintrc"
},
Expand Down
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

## 3.1.0 - 2016-12-19

### Added

- **multi-glob**: The `src` property can now take an array of globs (Closes [#15](https://github.com/groupe-sii/sonar-web-frontend-reporters/issues/15)) [@ValentinGot]
- **cli**: Add command line usage and version number [@ValentinGot]

### Fixed

- **es5**: The `.ES5.*` require method couldn't work, documentation has been updated accordingly [@ValentinGot]
- **es5**: `arr.includes()` method isn't available on ES5 (Closes [#14](https://github.com/groupe-sii/sonar-web-frontend-reporters/issues/14)) [@ValentinGot]
- **eslint**: use the `severity` property to retrieve the severity (Closes [#16](https://github.com/groupe-sii/sonar-web-frontend-reporters/issues/16)) [@ValentinGot]
- **eslint-angular**: use the `severity` property to retrieve the severity (Closes [#16](https://github.com/groupe-sii/sonar-web-frontend-reporters/issues/16)) [@ValentinGot]

## 3.0.0 - 2016-12-09

- Release first stable version

## 3.0.0-beta2 - 2016-12-07

- Add ES5 backward compatibility (Closes #13)

## 3.0.0-beta - 2016-12-05

### Added

- Full ES6
- Command-Line Interface
- Usable in NodeJS
- Refactored all reporters
- Contribution guide

### Removed

- Gulp abstraction

[@ole]: https://github.com/liollury
[@ValentinGot]: https://github.com/ValentinGot
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ cssLintReporter.launch(() => {
To use it with older NodeJS versions, you can require the reporters this way:

```js
const SonarWebReporters = require('sonar-web-frontend-reporters').ES5.Reporters;
const CSSLintReporter = require('sonar-web-frontend-reporters').ES5.CSSLintReporter;
var SonarWebReporters = require('sonar-web-frontend-reporters/build/reporters');
var CSSLintReporter = require('sonar-web-frontend-reporters/build/reporters/csslint.reporter');
```

## Available reporters
Expand Down
40 changes: 24 additions & 16 deletions bin/sreporter
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,29 @@

var chalk = require('chalk'),
version = require('../package.json').version,
es5 = (process.argv.includes('--es5') > -1),
program = require('commander'),
CLIEngine;

// Use ES5 backward compatibility ?
if (es5) {
CLIEngine = require('../build/cli');
} else {
CLIEngine = require('../lib/cli');
}

// Log version number
if (process.argv.includes('version') || process.argv.includes('--version')) {
console.info(chalk.bold('sreporter version v' + version));
process.exit(0);
}

var cli = new CLIEngine();
cli.launchReporters();
var CLI = {

/**
* Launch reporters
*/
launchReporters: function () {
if (program.es5) {
CLIEngine = require('../build/cli');
} else {
CLIEngine = require('../lib/cli');
}

(new CLIEngine()).launchReporters();
}

};

program
.version(version)
.option('--es5', 'launch CLI with ES5 backward compatibility')
.parse(process.argv);

CLI.launchReporters();
13 changes: 1 addition & 12 deletions build/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,5 @@ module.exports = {
JSHintReporter: require('./reporters/jshint.reporter'),
TSLintReporter: require('./reporters/tslint.reporter'),
SASSLintReporter: require('./reporters/sasslint.reporter'),
SASSToSCSSLintReporter: require('./reporters/sass-to-scsslint.reporter'),
ES5: {
Reporters: require('../build/reporters'),
CSSLintReporter: require('../build/reporters/csslint.reporter'),
ESLintReporter: require('../build/reporters/eslint.reporter'),
ESLintAngularReporter: require('../build/reporters/eslint-angular.reporter'),
HTMLHintReporter: require('../build/reporters/htmlhint.reporter'),
JSHintReporter: require('../build/reporters/jshint.reporter'),
TSLintReporter: require('../build/reporters/tslint.reporter'),
SASSLintReporter: require('../build/reporters/sasslint.reporter'),
SASSToSCSSLintReporter: require('../build/reporters/sass-to-scsslint.reporter')
}
SASSToSCSSLintReporter: require('./reporters/sass-to-scsslint.reporter')
};
2 changes: 1 addition & 1 deletion build/reporters/csslint.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
csslint = require('csslint').CSSLint,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
2 changes: 1 addition & 1 deletion build/reporters/eslint-angular.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
CLIEngine = require('eslint').CLIEngine,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
4 changes: 2 additions & 2 deletions build/reporters/eslint.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
CLIEngine = require('eslint').CLIEngine,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand All @@ -34,7 +34,7 @@ module.exports = function (_Reporter) {
configFile: this.options.rulesFile
});

glob(this.options.src, function (er, files) {
glob(this.options.src, function (err, files) {
_this2.processFiles(files, _this2.options);
_this2.closeReporter(_this2.options.report);

Expand Down
2 changes: 1 addition & 1 deletion build/reporters/htmlhint.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
HTMLHint = require('htmlhint').HTMLHint,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
2 changes: 1 addition & 1 deletion build/reporters/jshint.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
jshintcli = require('jshint/src/cli'),
jshint = require('jshint').JSHINT,
ReporterType = require('../reporter.enum'),
Expand Down
2 changes: 1 addition & 1 deletion build/reporters/sass-to-scsslint.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
sasslint = require('sass-lint'),
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter'),
Expand Down
2 changes: 1 addition & 1 deletion build/reporters/sasslint.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
sasslint = require('sass-lint'),
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
2 changes: 1 addition & 1 deletion build/reporters/tslint.reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var glob = require('glob'),
var glob = require('glob-all'),
TSLint = require('tslint'),
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
13 changes: 1 addition & 12 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,5 @@ module.exports = {
JSHintReporter : require('./reporters/jshint.reporter'),
TSLintReporter : require('./reporters/tslint.reporter'),
SASSLintReporter : require('./reporters/sasslint.reporter'),
SASSToSCSSLintReporter: require('./reporters/sass-to-scsslint.reporter'),
ES5 : {
Reporters : require('../build/reporters'),
CSSLintReporter : require('../build/reporters/csslint.reporter'),
ESLintReporter : require('../build/reporters/eslint.reporter'),
ESLintAngularReporter : require('../build/reporters/eslint-angular.reporter'),
HTMLHintReporter : require('../build/reporters/htmlhint.reporter'),
JSHintReporter : require('../build/reporters/jshint.reporter'),
TSLintReporter : require('../build/reporters/tslint.reporter'),
SASSLintReporter : require('../build/reporters/sasslint.reporter'),
SASSToSCSSLintReporter: require('../build/reporters/sass-to-scsslint.reporter')
}
SASSToSCSSLintReporter: require('./reporters/sass-to-scsslint.reporter')
};
2 changes: 1 addition & 1 deletion lib/reporters/csslint.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
csslint = require('csslint').CSSLint,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
4 changes: 2 additions & 2 deletions lib/reporters/eslint-angular.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
CLIEngine = require('eslint').CLIEngine,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down Expand Up @@ -48,7 +48,7 @@ module.exports = class ESLintAngularReporter extends Reporter {

this.openFileIssues(file, null, /^(\s+)?\n$/gm);
for (let message of result.results[0].messages) {
switch (message.type) {
switch (message.severity) {
case 2:
severity = this.MAJOR;
break;
Expand Down
6 changes: 3 additions & 3 deletions lib/reporters/eslint.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
CLIEngine = require('eslint').CLIEngine,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand All @@ -24,7 +24,7 @@ module.exports = class ESLintReporter extends Reporter {
configFile: this.options.rulesFile
});

glob(this.options.src, (er, files) => {
glob(this.options.src, (err, files) => {
this.processFiles(files, this.options);
this.closeReporter(this.options.report);

Expand All @@ -48,7 +48,7 @@ module.exports = class ESLintReporter extends Reporter {

this.openFileIssues(file, null, /^(\s+)?\n$/gm);
for (let message of result.results[0].messages) {
switch (message.type) {
switch (message.severity) {
case 2:
severity = this.MAJOR;
break;
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/htmlhint.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
HTMLHint = require('htmlhint').HTMLHint,
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/jshint.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
jshintcli = require('jshint/src/cli'),
jshint = require('jshint').JSHINT,
ReporterType = require('../reporter.enum'),
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/sass-to-scsslint.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
sasslint = require('sass-lint'),
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter'),
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/sasslint.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
sasslint = require('sass-lint'),
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters/tslint.reporter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const glob = require('glob'),
const glob = require('glob-all'),
TSLint = require('tslint'),
ReporterType = require('../reporter.enum'),
Reporter = require('../reporter');
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sonar-web-frontend-reporters",
"description": "This is a repo of SII continuous integration build system dedicated to Front-end webapps. This repo provides all the reporters written by SII for the generic [Sonarqube plugin](https://github.com/groupe-sii/sonar-web-client-plugin)",
"version": "3.0.0",
"description": "sreporter is a Command-Line Interface to generate Front-End linters reporters for the SonarQube plugin",
"version": "3.1.0",
"main": "./lib/api.js",
"bin": {
"sreporter": "./bin/sreporter"
Expand All @@ -22,6 +22,8 @@
"csslint",
"htmlhint",
"eslint",
"angularjs",
"tslint",
"sonar"
],
"author": "Cédric Le Gallo <[email protected]> (http://www.groupe-sii.com/)",
Expand All @@ -37,11 +39,13 @@
"homepage": "https://github.com/groupe-sii/sonar-web-frontend-reporters#readme",
"dependencies": {
"chalk": "^1.1.3",
"commander": "^2.9.0",
"csslint": "^1.0.4",
"eslint": "^3.11.1",
"eslint-config-angular": "^0.5.0",
"eslint-plugin-angular": "^1.4.1",
"glob": "^7.1.1",
"glob-all": "^3.1.0",
"htmlhint": "^0.9.13",
"jshint": "^2.9.4",
"mkdirp": "^0.5.1",
Expand Down
1 change: 1 addition & 0 deletions samples/src/bower_components/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var bower = 'bower';
28 changes: 28 additions & 0 deletions samples/src/nodejs.es5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var SonarWebReporters = require('../../build/reporters');

var sonarWebReporters = new SonarWebReporters('Sonar Web Reporters', {
"csslint": false,
"eslint": {
"src": "samples/src/**/*.js",
"report": "reports/sonar/eslint.json",
"rulesFile": "./samples/.eslintrc"
},
"eslintangular": {
"src": "samples/src/**/*.js",
"report": "reports/sonar/eslint-angular.json",
"rulesFile": "./samples/.eslintangularrc"
},
"jshint": {
"src": "samples/src/**/*.js",
"report": "reports/sonar/jshint.json",
"rulesFile": "./samples/.jshintrc"
},
"htmlhint": {
"src": "samples/src/**/*.html",
"report": "reports/sonar/htmlhint.json",
"rulesFile": "./samples/.htmlhintrc"
}
});
sonarWebReporters.launchReporters(function () {
console.log('All reporters have been processed');
});
4 changes: 2 additions & 2 deletions samples/src/nodejs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const SonarWebReporters = require('../../index').Reporters;
const SonarWebReporters = require('../../lib/api').Reporters;

let sonarWebReporters = new SonarWebReporters('Sonar Web Reporters', {
"csslint": false,
Expand All @@ -9,7 +9,7 @@ let sonarWebReporters = new SonarWebReporters('Sonar Web Reporters', {
},
"eslintangular": {
"src": "samples/src/**/*.js",
"report": "reports/sonar/eslintangular.json",
"report": "reports/sonar/eslint-angular.json",
"rulesFile": "./samples/.eslintangularrc"
},
"jshint": {
Expand Down
Loading

0 comments on commit f04e57f

Please sign in to comment.