Skip to content

Commit 9d21eda

Browse files
committed
Code cleanup with eslint
Fix removes: - unused vars - unused imports - converts double quotes to single ones - adds missing semicolons - simplify stubbing by using ful class stubbing
1 parent dc5b23d commit 9d21eda

43 files changed

Lines changed: 450 additions & 567 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

browser/bootstrap.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
import mainModule from './main';
24

35
angular.element(document).ready(function() {

browser/directives/breadcrumb.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
'use strict';
22

3-
function breadcrumb($state) {
3+
function breadcrumb() {
44
return {
55
restrict: 'E',
66
replace: true,
77
templateUrl: 'directives/breadcrumbs.html',
8-
compile: (tElement, tAttrs) => {
9-
return ($scope, $elem, $attr) => {
8+
compile: () => {
9+
return ($scope) => {
1010
$scope.show = (state) => {
1111
if (!angular.isDefined(state.data)) {
1212
return false;
1313
}
1414
return true;
1515
};
16-
}
16+
};
1717
},
1818
controller: ['$scope', '$state', ($scope, $state) => {
1919
$scope.$navItems = $state.get();
@@ -22,7 +22,7 @@ function breadcrumb($state) {
2222
return $state.$current.name == state.name;
2323
};
2424
}]
25-
}
25+
};
2626
}
2727

2828
export default breadcrumb;

browser/directives/pathValidator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function pathValidator() {
1414
function validateFormatWindows(value) {
1515
let trimmedValue = value.trim();
1616

17-
return pathWindowsRegex.test(value);
17+
return pathWindowsRegex.test(trimmedValue);
1818
}
1919

2020
function validateLength(value) {
@@ -47,7 +47,7 @@ function pathValidator() {
4747
mCtrl.$validators['invalidDisk'] = validateDisk;
4848
}
4949
}
50-
}
50+
};
5151
}
5252

5353
export default pathValidator;

browser/directives/progressBar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function progressBar() {
1515
status: '='
1616
},
1717
templateUrl: 'directives/progressBar.html'
18-
}
18+
};
1919
}
2020

2121
export default progressBar;

browser/main.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ let mainModule =
3131
.factory('installerDataSvc', InstallerDataService.factory)
3232
.factory('request', Request.factory)
3333
.directive(progressBar.name, progressBar)
34-
.directive(breadcrumb.name, ['$state', breadcrumb])
34+
.directive(breadcrumb.name, breadcrumb)
3535
.directive(pathValidator.name, pathValidator)
36-
.config( ["$stateProvider", "$urlRouterProvider", ($stateProvider, $urlRouterProvider) => {
36+
.config( ['$stateProvider', '$urlRouterProvider', ($stateProvider, $urlRouterProvider) => {
3737
$urlRouterProvider.otherwise('/account');
3838

3939
$stateProvider
@@ -75,63 +75,63 @@ let mainModule =
7575
}
7676
});
7777
}])
78-
.run( ['$rootScope', '$location', '$timeout', 'installerDataSvc', 'request', ($rootScope, $location, $timeout, installerDataSvc, request) => {
78+
.run( ['$timeout', 'installerDataSvc', ($timeout, installerDataSvc) => {
7979
let reqs = installerDataSvc.requirements;
8080

8181
let virtualbox = new VirtualBoxInstall(
82-
reqs['virtualbox.exe'].version,
83-
reqs['virtualbox.exe'].revision,
84-
installerDataSvc,
85-
reqs['virtualbox.exe'].url,
86-
null,
87-
'virtualbox',
88-
reqs['virtualbox.exe'].sha256sum),
82+
reqs['virtualbox.exe'].version,
83+
reqs['virtualbox.exe'].revision,
84+
installerDataSvc,
85+
reqs['virtualbox.exe'].url,
86+
null,
87+
'virtualbox',
88+
reqs['virtualbox.exe'].sha256sum);
8989

90-
cygwin = new CygwinInstall(
91-
installerDataSvc,
92-
reqs['cygwin.exe'].url,
93-
null,
94-
'cygwin',
95-
reqs['cygwin.exe'].sha256sum),
90+
let cygwin = new CygwinInstall(
91+
installerDataSvc,
92+
reqs['cygwin.exe'].url,
93+
null,
94+
'cygwin',
95+
reqs['cygwin.exe'].sha256sum);
9696

97-
vagrant = new VagrantInstall(
98-
installerDataSvc,
99-
reqs['vagrant.msi'].url,
100-
null,
101-
'vagrant',
102-
reqs['vagrant.msi'].sha256sum),
97+
let vagrant = new VagrantInstall(
98+
installerDataSvc,
99+
reqs['vagrant.msi'].url,
100+
null,
101+
'vagrant',
102+
reqs['vagrant.msi'].sha256sum);
103103

104-
cdk = new CDKInstall(
105-
installerDataSvc,
106-
$timeout,
107-
reqs['cdk.zip'].dmUrl,
108-
reqs['rhel-vagrant-virtualbox.box'].dmUrl,
109-
reqs['oc.zip'].url,
110-
null,
111-
'cdk',
112-
reqs['cdk.zip'].sha256sum,
113-
reqs['rhel-vagrant-virtualbox.box'].sha256sum,
114-
reqs['oc.zip'].sha256sum),
104+
let cdk = new CDKInstall(
105+
installerDataSvc,
106+
$timeout,
107+
reqs['cdk.zip'].dmUrl,
108+
reqs['rhel-vagrant-virtualbox.box'].dmUrl,
109+
reqs['oc.zip'].url,
110+
null,
111+
'cdk',
112+
reqs['cdk.zip'].sha256sum,
113+
reqs['rhel-vagrant-virtualbox.box'].sha256sum,
114+
reqs['oc.zip'].sha256sum);
115115

116-
jdk = new JdkInstall(
117-
installerDataSvc,
118-
reqs['jdk.msi'].dmUrl,
119-
null,
120-
reqs['jdk.msi'].prefix,
121-
'jdk8',
122-
reqs['jdk.msi'].sha256sum),
116+
let jdk = new JdkInstall(
117+
installerDataSvc,
118+
reqs['jdk.msi'].dmUrl,
119+
null,
120+
reqs['jdk.msi'].prefix,
121+
'jdk8',
122+
reqs['jdk.msi'].sha256sum);
123123

124-
jbds = new JbdsInstall(
125-
installerDataSvc,
126-
reqs['jbds.jar'].dmUrl,
127-
null,
128-
'developer-studio',
129-
reqs['jbds.jar'].sha256sum);
124+
let jbds = new JbdsInstall(
125+
installerDataSvc,
126+
reqs['jbds.jar'].dmUrl,
127+
null,
128+
'developer-studio',
129+
reqs['jbds.jar'].sha256sum);
130130

131-
installerDataSvc.addItemsToInstall(virtualbox,cygwin,vagrant,cdk,jdk,jbds);
131+
installerDataSvc.addItemsToInstall(virtualbox,cygwin,vagrant,cdk,jdk,jbds);
132132

133-
jdk.thenInstall(jbds);
134-
jdk.thenInstall(virtualbox).thenInstall(cygwin).thenInstall(vagrant).thenInstall(cdk);
133+
jdk.thenInstall(jbds);
134+
jdk.thenInstall(virtualbox).thenInstall(cygwin).thenInstall(vagrant).thenInstall(cdk);
135135

136136
}]);
137137

browser/model/cdk.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
let fs = require('fs-extra');
4-
var filesystem = require("fs");
4+
var filesystem = require('fs');
55
let path = require('path');
66

77
import InstallableItem from './installable-item';
@@ -53,7 +53,7 @@ class CDKInstall extends InstallableItem {
5353
let totalDownloads = 3;
5454
this.downloader = new Downloader(progress, success, failure, totalDownloads);
5555
let username = this.installerDataSvc.getUsername(),
56-
password = this.installerDataSvc.getPassword();
56+
password = this.installerDataSvc.getPassword();
5757

5858
let cdkBoxBundledFile = path.join(this.downloadFolder, this.boxName);
5959
if(fs.existsSync(cdkBoxBundledFile)) {

browser/model/cygwin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class CygwinInstall extends InstallableItem {
2525

2626
detectExistingInstall(done = function(){}) {
2727
if (Platform.OS === 'win32') {
28-
let cygwinPackageRegex = /cygwin\s*(\d+\.\d+\.\d+)/,
29-
opensshPackageReqex = /openssh\s*(\d+\.\d+)/,
30-
rsyncPackageRegex = /rsync\s*(\d+\.\d+\.\d+)/;
28+
let cygwinPackageRegex = /cygwin\s*(\d+\.\d+\.\d+)/;
29+
let opensshPackageReqex = /openssh\s*(\d+\.\d+)/;
30+
let rsyncPackageRegex = /rsync\s*(\d+\.\d+\.\d+)/;
3131
Util.executeCommand('cygcheck -c cygwin openssh rsync').then((out)=>{
3232
let cygwinVersion = cygwinPackageRegex.exec(out)[1];
3333
let opensshVersion = opensshPackageReqex.exec(out)[1];
@@ -95,7 +95,7 @@ class CygwinInstall extends InstallableItem {
9595
let originalExecFile = path.join(this.installerDataSvc.cygwinDir(),'setup-x86_64.exe');
9696
installer.execFile(
9797
this.downloadedFile, opts
98-
).then((result) => {
98+
).then(() => {
9999
return installer.copyFile(
100100
this.downloadedFile, originalExecFile, true);
101101
}).then((result) => {

browser/model/helpers/downloader.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,26 @@ class Downloader {
6363
}
6464

6565
closeHandler(file,sha,url) {
66-
if(this.downloads.get(file) && this.downloads.get(file)['failure']) {
67-
return;
68-
}
69-
if(sha) {
70-
Logger.log(`Configured file='${file}' sha256='${sha}'`);
71-
var h = new Hash();
72-
h.SHA256(file,(dlSha) => {
73-
if(sha === dlSha) {
74-
Logger.log(`Downloaded file='${file}' sha256='${dlSha}'`);
75-
this.successHandler(file);
76-
} else {
77-
if(this.downloads.get(file)) {
78-
this.downloads.get(file)['failure'] = true;
79-
}
80-
this.failure('SHA256 checksum verification failed');
66+
if(this.downloads.get(file) && this.downloads.get(file)['failure']) {
67+
return;
68+
}
69+
if(sha) {
70+
Logger.log(`Configured file='${file}' sha256='${sha}'`);
71+
var h = new Hash();
72+
h.SHA256(file,(dlSha) => {
73+
if(sha === dlSha) {
74+
Logger.log(`Downloaded file='${file}' sha256='${dlSha}'`);
75+
this.successHandler(file);
76+
} else {
77+
if(this.downloads.get(file)) {
78+
this.downloads.get(file)['failure'] = true;
8179
}
82-
});
83-
} else {
84-
this.successHandler(file);
85-
}
80+
this.failure('SHA256 checksum verification failed');
81+
}
82+
});
83+
} else {
84+
this.successHandler(file);
85+
}
8686
}
8787

8888
successHandler(file) {
@@ -119,8 +119,6 @@ class Downloader {
119119
.on('close', this.closeHandler.bind(this,stream.path,sha,options));
120120
}
121121

122-
123-
124122
restartDownload() {
125123
this.downloadSize = 0;
126124
this.received = 0;

browser/model/helpers/installer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Installer {
3737
execFile(file, args, result) {
3838
return new Promise((resolve, reject) => {
3939
Logger.info(this.key + ' - Execute ' + file + ' ' + args);
40-
child_process.execFile(file, args, {"maxBuffer": 1024*1024} , (error, stdout, stderr) => {
40+
child_process.execFile(file, args, {'maxBuffer': 1024*1024} , (error, stdout, stderr) => {
4141
// vagrant exits with code 3010
4242
if (error && error !== '' && error.code !== 3010) {
4343
Logger.error(this.key + ' - ' + error);

browser/model/installable-item.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class InstallableItem {
131131
this.downloadUrl,
132132
this.sha256,
133133
this.authRequired ? this.installerDataSvc.getUsername() : undefined,
134-
this.authRequired ? this.installerDataSvc.getPassword() : undefined,
134+
this.authRequired ? this.installerDataSvc.getPassword() : undefined
135135
);
136136
}
137137
}

0 commit comments

Comments
 (0)