Skip to content

Commit

Permalink
style: Apply linter rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Seidelsohn committed May 30, 2021
1 parent 0ed8a22 commit 407bf06
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 180 deletions.
6 changes: 3 additions & 3 deletions scripts/contrib.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ json.contributors = [
'zodiac403 <zodiac403@gmx.de>',
]; //clear it

GitContributors.list(opts, function(err, result) {
result.forEach(function(item) {
GitContributors.list(opts, function (err, result) {
result.forEach(function (item) {
json.contributors.push([item.name, `<${item.email}>`].join(' '));
});

json.contributors.sort();

format(pkg, json, function() {
format(pkg, json, function () {
console.log(`Wrote ${result.length} contributors to: ${pkg}`);
});
});
6 changes: 3 additions & 3 deletions tests/bin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ const assert = require('assert');
const path = require('path');
const spawn = require('child_process').spawn;

describe('bin/license-checker-rseidelsohn', function() {
describe('bin/license-checker-rseidelsohn', function () {
this.timeout(8000);

it('should exit 0', function(done) {
it('should exit 0', function (done) {
spawn('node', [path.join(__dirname, '../bin/license-checker-rseidelsohn')], {
cwd: path.join(__dirname, '../'),
stdio: 'ignore',
}).on('exit', function(code) {
}).on('exit', function (code) {
assert.equal(code, 0);
done();
});
Expand Down
18 changes: 9 additions & 9 deletions tests/failOn-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@ const assert = require('assert');
const path = require('path');
const spawn = require('child_process').spawn;

describe('bin/license-checker-rseidelsohn', function() {
describe('bin/license-checker-rseidelsohn', function () {
this.timeout(8000);
it('should exit 1 if it finds a single license type (MIT) license due to --failOn MIT', function(done) {
it('should exit 1 if it finds a single license type (MIT) license due to --failOn MIT', function (done) {
spawn('node', [path.join(__dirname, '../bin/license-checker-rseidelsohn'), '--failOn', 'MIT'], {
cwd: path.join(__dirname, '../'),
stdio: 'ignore',
}).on('exit', function(code) {
}).on('exit', function (code) {
assert.equal(code, 1);
done();
});
});

it('should exit 1 if it finds forbidden licenses license due to --failOn MIT;ISC', function(done) {
it('should exit 1 if it finds forbidden licenses license due to --failOn MIT;ISC', function (done) {
spawn('node', [path.join(__dirname, '../bin/license-checker-rseidelsohn'), '--failOn', 'MIT;ISC'], {
cwd: path.join(__dirname, '../'),
stdio: 'ignore',
}).on('exit', function(code) {
}).on('exit', function (code) {
assert.equal(code, 1);
done();
});
});

it('should give warning about commas if --failOn MIT,ISC is provided', function(done) {
it('should give warning about commas if --failOn MIT,ISC is provided', function (done) {
var proc = spawn('node', [path.join(__dirname, '../bin/license-checker-rseidelsohn'), '--failOn', 'MIT,ISC'], {
cwd: path.join(__dirname, '../'),
stdio: 'pipe',
});
var stderr = '';
proc.stdout.on('data', function() {});
proc.stderr.on('data', function(data) {
proc.stdout.on('data', function () {});
proc.stderr.on('data', function (data) {
stderr += data.toString();
});
proc.on('close', function() {
proc.on('close', function () {
assert.equal(
stderr.indexOf('--failOn argument takes semicolons as delimeters instead of commas') >= 0,
true,
Expand Down
20 changes: 10 additions & 10 deletions tests/license-files-test.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
const assert = require('assert');
const licenseFiles = require('../lib/license-files');

describe('license files detector', function() {
it('should export a function', function() {
describe('license files detector', function () {
it('should export a function', function () {
assert.equal(typeof licenseFiles, 'function');
});

it('no files', function() {
it('no files', function () {
assert.deepEqual(licenseFiles([]), []);
});

it('no license files', function() {
it('no license files', function () {
assert.deepEqual(licenseFiles(['.gitignore', '.travis.yml', 'TODO']), []);
});

it('one license candidate', function() {
it('one license candidate', function () {
assert.deepEqual(licenseFiles(['LICENSE', '.gitignore', 'src']), ['LICENSE']);
});

it('multiple license candidates detected in the right order', function() {
it('multiple license candidates detected in the right order', function () {
assert.deepEqual(licenseFiles(['COPYING', '.gitignore', 'LICENCE', 'LICENSE', 'src', 'README']), [
'LICENSE',
'LICENCE',
Expand All @@ -27,19 +27,19 @@ describe('license files detector', function() {
]);
});

it('extensions have no effect', function() {
it('extensions have no effect', function () {
assert.deepEqual(licenseFiles(['LICENCE.txt', '.gitignore', 'src']), ['LICENCE.txt']);
});

it('lower/upper case has no effect', function() {
it('lower/upper case has no effect', function () {
assert.deepEqual(licenseFiles(['LiCeNcE', '.gitignore', 'src']), ['LiCeNcE']);
});

it('LICENSE-MIT gets matched', function() {
it('LICENSE-MIT gets matched', function () {
assert.deepEqual(licenseFiles(['LICENSE', '.gitignore', 'LICENSE-MIT', 'src']), ['LICENSE', 'LICENSE-MIT']);
});

it('only the first LICENSE-* file gets matched', function() {
it('only the first LICENSE-* file gets matched', function () {
assert.deepEqual(licenseFiles(['license-foobar.txt', '.gitignore', 'LICENSE-MIT']), ['license-foobar.txt']);
});
});
10 changes: 5 additions & 5 deletions tests/packages-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ const assert = require('assert');
const path = require('path');
const spawn = require('child_process').spawnSync;

describe('bin/license-checker-rseidelsohn', function() {
describe('bin/license-checker-rseidelsohn', function () {
this.timeout(8000);

it('should restrict the output to the provided packages', function() {
it('should restrict the output to the provided packages', function () {
var restrictedPackages = ['@types/node@15.0.1'];
var output = spawn(
'node',
Expand All @@ -23,7 +23,7 @@ describe('bin/license-checker-rseidelsohn', function() {
assert.deepEqual(Object.keys(JSON.parse(output.stdout.toString())), restrictedPackages);
});

it('should exclude provided excludedPackages from the output', function() {
it('should exclude provided excludedPackages from the output', function () {
var excludedPackages = ['@types/node@15.0.1', 'spdx-satisfies@5.0.0', 'y18n@3.2.1'];
var output = spawn(
'node',
Expand All @@ -39,12 +39,12 @@ describe('bin/license-checker-rseidelsohn', function() {
);

var packages = Object.keys(JSON.parse(output.stdout.toString()));
excludedPackages.forEach(function(pkg) {
excludedPackages.forEach(function (pkg) {
assert.ok(!packages.includes(pkg));
});
});

it('should exclude private packages from the output', function() {
it('should exclude private packages from the output', function () {
var output = spawn(
'node',
[path.join(__dirname, '../bin/license-checker-rseidelsohn'), '--json', '--excludePrivatePackages'],
Expand Down
Loading

0 comments on commit 407bf06

Please sign in to comment.