Skip to content

Commit 9b0c66b

Browse files
committed
chore: autoformatted according to rules after #664
1 parent cac9b84 commit 9b0c66b

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

index.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let deploymentConfig
1717
module.exports = (robot, _, Settings = require('./lib/settings')) => {
1818
let appName = 'safe-settings'
1919
let appSlug = 'safe-settings'
20-
async function syncAllSettings (nop, context, repo = context.repo(), ref) {
20+
async function syncAllSettings(nop, context, repo = context.repo(), ref) {
2121
try {
2222
deploymentConfig = await loadYamlFileSystem()
2323
robot.log.debug(`deploymentConfig is ${JSON.stringify(deploymentConfig)}`)
@@ -46,7 +46,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
4646
}
4747
}
4848

49-
async function syncSubOrgSettings (nop, context, suborg, repo = context.repo(), ref) {
49+
async function syncSubOrgSettings(nop, context, suborg, repo = context.repo(), ref) {
5050
try {
5151
deploymentConfig = await loadYamlFileSystem()
5252
robot.log.debug(`deploymentConfig is ${JSON.stringify(deploymentConfig)}`)
@@ -71,7 +71,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
7171
}
7272
}
7373

74-
async function syncSettings (nop, context, repo = context.repo(), ref) {
74+
async function syncSettings(nop, context, repo = context.repo(), ref) {
7575
try {
7676
deploymentConfig = await loadYamlFileSystem()
7777
robot.log.debug(`deploymentConfig is ${JSON.stringify(deploymentConfig)}`)
@@ -96,7 +96,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
9696
}
9797
}
9898

99-
async function renameSync (nop, context, repo = context.repo(), rename, ref) {
99+
async function renameSync(nop, context, repo = context.repo(), rename, ref) {
100100
try {
101101
deploymentConfig = await loadYamlFileSystem()
102102
robot.log.debug(`deploymentConfig is ${JSON.stringify(deploymentConfig)}`)
@@ -105,7 +105,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
105105
const config = Object.assign({}, deploymentConfig, runtimeConfig)
106106
const renameConfig = Object.assign({}, config, rename)
107107
robot.log.debug(`config for ref ${ref} is ${JSON.stringify(config)}`)
108-
return Settings.sync(nop, context, repo, renameConfig, ref )
108+
return Settings.sync(nop, context, repo, renameConfig, ref)
109109
} catch (e) {
110110
if (nop) {
111111
let filename = env.SETTINGS_FILE_PATH
@@ -127,7 +127,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
127127
*
128128
* @return The parsed YAML file
129129
*/
130-
async function loadYamlFileSystem () {
130+
async function loadYamlFileSystem() {
131131
if (deploymentConfig === undefined) {
132132
const deploymentConfigPath = env.DEPLOYMENT_CONFIG_FILE
133133
if (fs.existsSync(deploymentConfigPath)) {
@@ -139,7 +139,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
139139
return deploymentConfig
140140
}
141141

142-
function getAllChangedSubOrgConfigs (payload) {
142+
function getAllChangedSubOrgConfigs(payload) {
143143
const settingPattern = new Glob(`${env.CONFIG_PATH}/suborgs/*.yml`)
144144
// Changes will be an array of files that were added
145145
const added = payload.commits.map(c => {
@@ -163,7 +163,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
163163
return configs
164164
}
165165

166-
function getAllChangedRepoConfigs (payload, owner) {
166+
function getAllChangedRepoConfigs(payload, owner) {
167167
const settingPattern = new Glob(`${env.CONFIG_PATH}/repos/*.yml`)
168168
// Changes will be an array of files that were added
169169
const added = payload.commits.map(c => {
@@ -186,7 +186,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
186186
return configs
187187
}
188188

189-
function getChangedRepoConfigName (glob, files, owner) {
189+
function getChangedRepoConfigName(glob, files, owner) {
190190
const modifiedFiles = files.filter(s => {
191191
robot.log.debug(JSON.stringify(s))
192192
return (s.search(glob) >= 0)
@@ -197,7 +197,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
197197
})
198198
}
199199

200-
function getChangedSubOrgConfigName (glob, files) {
200+
function getChangedSubOrgConfigName(glob, files) {
201201
const modifiedFiles = files.filter(s => {
202202
robot.log.debug(JSON.stringify(s))
203203
return (s.search(glob) >= 0)
@@ -209,7 +209,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
209209
})
210210
}
211211

212-
async function createCheckRun (context, pull_request, head_sha) {
212+
async function createCheckRun(context, pull_request, head_sha) {
213213
const { payload } = context
214214
// robot.log.debug(`Check suite was requested! for ${context.repo()} ${pull_request.number} ${head_sha} ${head_branch}`)
215215
const res = await context.octokit.checks.create({
@@ -238,7 +238,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
238238
}
239239

240240

241-
async function syncInstallation () {
241+
async function syncInstallation() {
242242
robot.log.trace('Fetching installations')
243243
const github = await robot.auth()
244244

@@ -399,7 +399,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
399399
})
400400

401401
robot.on('repository.renamed', async context => {
402-
if (env.BLOCK_REPO_RENAME_BY_HUMAN!== 'true') {
402+
if (env.BLOCK_REPO_RENAME_BY_HUMAN !== 'true') {
403403
robot.log.debug(`"env.BLOCK_REPO_RENAME_BY_HUMAN" is 'false' by default. Repo rename is not managed by Safe-settings. Continue with the default behavior.`)
404404
return
405405
}
@@ -418,7 +418,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
418418
const newPath = `.github/repos/${payload.repository.name}.yml`
419419
robot.log.debug(oldPath)
420420
try {
421-
const repofile = await context.octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
421+
const repofile = await context.octokit.request('GET /repos/{owner}/{repo}/contents/{path}', {
422422
owner: payload.repository.owner.login,
423423
repo: env.ADMIN_REPO,
424424
path: oldPath,
@@ -447,7 +447,7 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
447447
owner: payload.repository.owner.login,
448448
repo: env.ADMIN_REPO,
449449
path: newPath,
450-
name: `${payload.repository.name}.yml`,
450+
name: `${payload.repository.name}.yml`,
451451
content: content,
452452
message: `Repo Renamed and safe-settings renamed the file from ${payload.changes.repository.name.from} to ${payload.repository.name}`,
453453
sha: repofile.data.sha,
@@ -472,8 +472,8 @@ module.exports = (robot, _, Settings = require('./lib/settings')) => {
472472
} else {
473473
robot.log.debug('Repository Edited by a Human')
474474
// Create a repository config to reset the name back to the previous name
475-
const rename = {repository: { name: payload.changes.repository.name.from, oldname: payload.repository.name}}
476-
const repo = {repo: payload.changes.repository.name.from, owner: payload.repository.owner.login}
475+
const rename = { repository: { name: payload.changes.repository.name.from, oldname: payload.repository.name } }
476+
const repo = { repo: payload.changes.repository.name.from, owner: payload.repository.owner.login }
477477
return renameSync(false, context, repo, rename)
478478
}
479479
})

lib/settings.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Settings {
1717
* @param {boolean} nop
1818
* @param {Context} context
1919
*/
20-
static async syncAll (nop, context, repo, config, ref) {
20+
static async syncAll(nop, context, repo, config, ref) {
2121
const settings = new Settings(nop, context, repo, config, ref)
2222
try {
2323
await settings.loadConfigs()
@@ -183,10 +183,10 @@ class Settings {
183183

184184
//remove duplicate rows in this.results
185185
this.results = this.results.filter((thing, index, self) => {
186-
return index === self.findIndex((t) => {
187-
return t.type === thing.type && t.repo === thing.repo && t.plugin === thing.plugin
188-
})
186+
return index === self.findIndex((t) => {
187+
return t.type === thing.type && t.repo === thing.repo && t.plugin === thing.plugin
189188
})
189+
})
190190

191191
let error = false
192192
// Different logic

0 commit comments

Comments
 (0)