Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5ed1046

Browse files
committedNov 16, 2016
attempt-backport: fix lint
Refs: #77 PR-URL: #90
1 parent 4df276e commit 5ed1046

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed
 

‎scripts/attempt-backport.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = function (app) {
5353
})
5454
}
5555

56-
function processNextBackport() {
56+
function processNextBackport () {
5757
const item = queue.shift()
5858
if (!item) return
5959

@@ -67,18 +67,18 @@ function processNextBackport() {
6767
item()
6868
}
6969

70-
function queueAttemptBackport(options, version, isLTS) {
71-
queue.push(function() {
70+
function queueAttemptBackport (options, version, isLTS) {
71+
queue.push(function () {
7272
options.logger.debug(`processing a new backport to v${version}`)
7373
attemptBackport(options, version, isLTS, processNextBackport)
7474
})
7575
}
7676

77-
function attemptBackport(options, version, isLTS, cb) {
77+
function attemptBackport (options, version, isLTS, cb) {
7878
// Start
7979
gitAmAbort()
8080

81-
function wrapCP(cmd, args, opts, callback) {
81+
function wrapCP (cmd, args, opts, callback) {
8282
let exited = false
8383

8484
if (arguments.length === 3) {
@@ -91,11 +91,11 @@ function attemptBackport(options, version, isLTS, cb) {
9191
const cp = child_process.spawn(cmd, args, opts)
9292
const argsString = [cmd, ...args].join(' ')
9393

94-
cp.on('error', function(err) {
94+
cp.on('error', function (err) {
9595
debug(`child_process err: ${err}`)
9696
if (!exited) onError()
9797
})
98-
cp.on('exit', function(code) {
98+
cp.on('exit', function (code) {
9999
exited = true
100100
if (!cb) {
101101
debug(`error before exit, code: ${code}, on '${argsString}'`)
@@ -119,7 +119,7 @@ function attemptBackport(options, version, isLTS, cb) {
119119
return cp
120120
}
121121

122-
function onError() {
122+
function onError () {
123123
if (!cb) return
124124
const _cb = cb
125125
setImmediate(() => {
@@ -133,19 +133,19 @@ function attemptBackport(options, version, isLTS, cb) {
133133
cb = null
134134
}
135135

136-
function gitAmAbort() {
136+
function gitAmAbort () {
137137
// TODO(Fishrock123): this should probably just merge into wrapCP
138138
let exited = false
139-
options.logger.debug(`aborting any previous backport attempt...`)
139+
options.logger.debug('aborting any previous backport attempt...')
140140

141141
const cp = child_process.spawn('git', ['am', '--abort'], { cwd: global._node_repo_dir })
142142
const argsString = 'git am --abort'
143143

144-
cp.on('error', function(err) {
144+
cp.on('error', function (err) {
145145
debug(`child_process err: ${err}`)
146146
if (!exited) onError()
147147
})
148-
cp.on('exit', function() {
148+
cp.on('exit', function (code) {
149149
exited = true
150150
if (!cb) {
151151
debug(`error before exit, code: ${code}, on '${argsString}'`)
@@ -155,33 +155,33 @@ function attemptBackport(options, version, isLTS, cb) {
155155
})
156156
}
157157

158-
function gitRemoteUpdate() {
159-
options.logger.debug(`updating git remotes...`)
158+
function gitRemoteUpdate () {
159+
options.logger.debug('updating git remotes...')
160160
wrapCP('git', ['remote', 'update', '-p'], gitCheckout)
161161
}
162162

163-
function gitCheckout() {
163+
function gitCheckout () {
164164
options.logger.debug(`checking out upstream/v${version}.x-staging...`)
165165
wrapCP('git', ['checkout', `upstream/v${version}.x-staging`], gitReset)
166166
}
167167

168-
function gitReset() {
168+
function gitReset () {
169169
options.logger.debug(`resetting upstream/v${version}.x-staging...`)
170170
wrapCP('git', ['reset', `upstream/v${version}.x-staging`, '--hard'], fetchDiff)
171171
}
172172

173-
function fetchDiff() {
173+
function fetchDiff () {
174174
options.logger.debug(`fetching diff from pr ${options.prId}...`)
175175

176176
const url = `https://patch-diff.githubusercontent.com/raw/${options.owner}/${options.repo}/pull/${options.prId}.patch`
177177

178178
const req = request(url)
179179

180-
req.on('error', function(err) {
180+
req.on('error', function (err) {
181181
debug(`request err: ${err}`)
182182
return onError()
183183
})
184-
req.on('response', function(response) {
184+
req.on('response', function (response) {
185185
if (response.statusCode !== 200) {
186186
debug(`request non-200 status: ${response.statusCode}`)
187187
return onError()
@@ -191,17 +191,17 @@ function attemptBackport(options, version, isLTS, cb) {
191191
gitAttemptBackport(req)
192192
}
193193

194-
function gitAttemptBackport(req) {
194+
function gitAttemptBackport (req) {
195195
options.logger.debug(`attempting a backport to v${version}...`)
196-
const cp = wrapCP('git', ['am'], { stdio: 'pipe' }, function done() {
196+
const cp = wrapCP('git', ['am'], { stdio: 'pipe' }, function done () {
197197
// Success!
198198
if (isLTS) {
199199
updatePrWithLabels(options, [`lts-watch-v${version}.x`])
200200
}// else {
201201
// TODO(Fishrock123): Re-enable this, but do a check first
202202
// to make sure the label was set by the bot only.
203203
// removeLabelFromPR(options, `dont-land-on-v${version}.x`)
204-
//}
204+
// }
205205

206206
setImmediate(() => {
207207
options.logger.debug(`backport to v${version} successful`)

0 commit comments

Comments
 (0)
Please sign in to comment.