Skip to content

Commit 876a487

Browse files
committed
adding some analysis for sample purpose
1 parent a7fc523 commit 876a487

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

.testspace

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
## Test Content files to publish
2+
$CI_REPORTS/jshint.xml
3+
$CI_REPORTS/jscs.xml
24
[Tests]$CI_REPORTS/junitresults.xml{test}
35
$CI_REPORTS/coverage/clover.xml

gulpfile.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ var jasmine = require('gulp-jasmine');
66
var istanbul = require('gulp-istanbul');
77
var reporters = require('jasmine-reporters');
88
var stylish = require('jshint-stylish');
9+
var jshintXMLReporter = require('gulp-jshint-xml-file-reporter');
910
var jscs = require('gulp-jscs');
11+
var jscs = require('gulp-jscs-custom');
1012
var isWin = /^win/.test(process.platform);
1113

1214
gulp.task('jsdoc', shell.task([
@@ -17,9 +19,13 @@ gulp.task('jsdoc', shell.task([
1719

1820
gulp.task('lint', function () {
1921
return gulp.src(['./src/**/*.js'], ['./test/**/*.js'])
20-
.pipe(jshint())
21-
.pipe(jshint.reporter(stylish))
22-
.pipe(jshint.reporter('fail'));
22+
.pipe(jshint())
23+
.pipe(jshint.reporter(jshintXMLReporter))
24+
.on('end', jshintXMLReporter.writeFile({
25+
format: 'checkstyle',
26+
filePath: './test/reports/jshint.xml',
27+
alwaysReport: 'true'
28+
}));
2329
});
2430

2531
gulp.task('pre-test', function () {
@@ -46,7 +52,14 @@ gulp.task('test', ['pre-test'], function () {
4652

4753
gulp.task('jscs', function () {
4854
return gulp.src(['src/**/*.js', 'test/**/*.js'])
49-
.pipe(jscs());
55+
.pipe(jscs({
56+
esnext: false,
57+
configPath: '.jscsrc',
58+
reporter: 'checkstyle',
59+
filePath: './test/reports/jscs.xml',
60+
failOnError: false
61+
}));
5062
});
5163

64+
5265
gulp.task('build', ['lint', 'jscs', 'test']);

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"gulp-istanbul": "^0.10.4",
1212
"gulp-jasmine": "^2.0.1",
1313
"gulp-jscs": "^1.4.0",
14+
"gulp-jscs-custom": "^0.1.6",
1415
"gulp-jshint": "^1.9.0",
16+
"gulp-jshint-xml-file-reporter": "^0.5.1",
1517
"gulp-shell": "^0.2.11",
1618
"jasmine-reporters": "^2.0.0",
1719
"jsdoc": "3.4.0",

src/sets/quickfind.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @param {Numner} size Count of the nodes.
3737
*/
3838
exports.QuickFind = function (size) {
39-
this._ids = [];
39+
this._ids = [] // sample, removed ";"
4040
for (var i = 0; i < size; i += 1) {
4141
this._ids[i] = i;
4242
}
@@ -52,8 +52,8 @@
5252
* @param {Number} q The second node.
5353
*/
5454
exports.QuickFind.prototype.union = function (p, q) {
55-
var size = this._ids.length;
56-
var pval = this._ids[p];
55+
var size = this._ids.length;
56+
var pval = this._ids[p]
5757
var qval = this._ids[q];
5858
for (var i = 0; i < size; i += 1) {
5959
if (this._ids[i] === qval) {
@@ -72,7 +72,7 @@
7272
* @param {Number} q The second node.
7373
* @return {Boolean}
7474
*/
75-
exports.QuickFind.prototype.connected = function (p, q) {
76-
return this._ids[p] === this._ids[q];
75+
exports.QuickFind.prototype.connected = function (p, q) {
76+
return this._ids[p] === this._ids[q]
7777
};
7878
})(typeof window === 'undefined' ? module.exports : window);

0 commit comments

Comments
 (0)