Skip to content

Commit

Permalink
Update Prettier config to minimize changes and follow styleguide
Browse files Browse the repository at this point in the history
  • Loading branch information
lumaxis authored May 6, 2024
1 parent 1faa1dd commit 29fd50a
Show file tree
Hide file tree
Showing 126 changed files with 792 additions and 797 deletions.
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"arrowParens": "avoid",
"printWidth": 120,
"singleQuote": true,
"semi": false
"semi": false,
"trailingComma": "none"
}
40 changes: 20 additions & 20 deletions config/cdConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const config = require('painless-config')

const cd_azblob = {
connection: config.get('CRAWLER_AZBLOB_CONNECTION_STRING'),
container: config.get('CRAWLER_AZBLOB_CONTAINER_NAME'),
container: config.get('CRAWLER_AZBLOB_CONTAINER_NAME')
}

const githubToken = config.get('CRAWLER_GITHUB_TOKEN')

const cd_file = {
location: config.get('FILE_STORE_LOCATION') || (process.platform === 'win32' ? 'c:/temp/cd' : '/tmp/cd'),
location: config.get('FILE_STORE_LOCATION') || (process.platform === 'win32' ? 'c:/temp/cd' : '/tmp/cd')
}
const crawlerStoreProvider = config.get('CRAWLER_STORE_PROVIDER') || 'cd(file)'
const maxRequeueAttemptCount = config.get('CRAWLER_MAX_REQUEUE_ATTEMPTS') || 5
Expand All @@ -22,20 +22,20 @@ module.exports = {
searchPath: [module],
crawler: {
count: 2,
maxRequeueAttemptCount,
maxRequeueAttemptCount
},
filter: {
provider: 'filter',
filter: {},
filter: {}
},
fetch: {
dispatcher: 'cdDispatch',
cdDispatch: {
fetched: { defaultTtlSeconds: fetchedCacheTtlSeconds },
fetched: { defaultTtlSeconds: fetchedCacheTtlSeconds }
},
cocoapods: { githubToken },
conda: {
cdFileLocation: cd_file.location,
cdFileLocation: cd_file.location
},
cratesio: {},
debian: { cdFileLocation: cd_file.location },
Expand All @@ -48,7 +48,7 @@ module.exports = {
nuget: {},
packagist: {},
pypi: {},
rubygems: {},
rubygems: {}
},
process: {
cdsource: {},
Expand All @@ -60,7 +60,7 @@ module.exports = {
debsrc: {},
fossology: {
disabled: true,
installDir: config.get('FOSSOLOGY_HOME') || '/mnt/c/git/fo/fossology/src/',
installDir: config.get('FOSSOLOGY_HOME') || '/mnt/c/git/fo/fossology/src/'
},
gem: { githubToken },
go: { githubToken },
Expand Down Expand Up @@ -90,39 +90,39 @@ module.exports = {
'--classify',
'--generated',
'--summary',
'--summary-key-files',
'--summary-key-files'
// '--quiet'
],
timeout: 1000,
processes: 2,
format: '--json-pp',
format: '--json-pp'
},
source: {},
top: { githubToken },
top: { githubToken }
},
store: {
dispatcher: crawlerStoreProvider,
cdDispatch: {},
webhook: {
url: config.get('CRAWLER_WEBHOOK_URL') || 'http://localhost:4000/webhook',
token: config.get('CRAWLER_WEBHOOK_TOKEN'),
token: config.get('CRAWLER_WEBHOOK_TOKEN')
},
azqueue: {
connectionString: cd_azblob.connection,
queueName: config.get('CRAWLER_HARVESTS_QUEUE_NAME') || 'harvests',
queueName: config.get('CRAWLER_HARVESTS_QUEUE_NAME') || 'harvests'
},
'cd(azblob)': cd_azblob,
'cd(file)': cd_file,
'cd(file)': cd_file
},
deadletter: {
provider: config.get('CRAWLER_DEADLETTER_PROVIDER') || crawlerStoreProvider,
'cd(azblob)': cd_azblob,
'cd(file)': cd_file,
'cd(file)': cd_file
},
queue: {
provider: config.get('CRAWLER_QUEUE_PROVIDER') || 'memory',
memory: {
weights: { immediate: 3, soon: 2, normal: 3, later: 2 },
weights: { immediate: 3, soon: 2, normal: 3, later: 2 }
},
storageQueue: {
weights: { immediate: 3, soon: 2, normal: 3, later: 2 },
Expand All @@ -132,8 +132,8 @@ module.exports = {
visibilityTimeout_remainLocal: fetchedCacheTtlSeconds,
maxDequeueCount: 5,
attenuation: {
ttl: 3000,
},
},
},
ttl: 3000
}
}
}
}
16 changes: 8 additions & 8 deletions config/cdMemoryConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
module.exports = {
crawler: {
count: 1,
maxRequeueAttemptCount: 5,
maxRequeueAttemptCount: 5
},
fetch: {
github: {},
github: {}
},
process: {
scancode: {},
licensee: {},
reuse: {},
reuse: {}
},
store: {
provider: 'memory',
provider: 'memory'
},
deadletter: {
provider: 'memory',
provider: 'memory'
},
queue: {
provider: 'memory',
memory: {
weights: { events: 10, immediate: 3, soon: 2, normal: 3, later: 2 },
},
},
weights: { events: 10, immediate: 3, soon: 2, normal: 3, later: 2 }
}
}
}
32 changes: 16 additions & 16 deletions config/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const source = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const npm = {
Expand All @@ -32,7 +32,7 @@ const npm = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const conda = {
Expand All @@ -42,7 +42,7 @@ const conda = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const crate = {
Expand All @@ -52,7 +52,7 @@ const crate = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const deb = {
Expand All @@ -62,7 +62,7 @@ const deb = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const go = {
Expand All @@ -72,7 +72,7 @@ const go = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const maven = {
Expand All @@ -82,7 +82,7 @@ const maven = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const nuget = {
Expand All @@ -91,7 +91,7 @@ const nuget = {
clearlydefined,
licensee,
scancode,
reuse,
reuse
}

const pod = {
Expand All @@ -101,7 +101,7 @@ const pod = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const pypi = {
Expand All @@ -111,7 +111,7 @@ const pypi = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const composer = {
Expand All @@ -121,7 +121,7 @@ const composer = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const gem = {
Expand All @@ -131,7 +131,7 @@ const gem = {
licensee,
reuse,
scancode,
fossology,
fossology
}

const _package = {
Expand All @@ -146,13 +146,13 @@ const _package = {
pod,
pypi,
composer,
gem,
gem
}

const component = {
_type: 'component',
source,
package: _package,
package: _package
}

const entities = {
Expand All @@ -176,9 +176,9 @@ const entities = {
composer,
pod,
pypi,
gem,
gem
}

module.exports = {
default: entities,
default: entities
}
12 changes: 6 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ module.exports = [
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
...globals.mocha
},
parserOptions: {
sourceType: 'module',
},
sourceType: 'module'
}
},
rules: {
quotes: ['error', 'single'],
semi: ['error', 'never'],
'no-console': 'off',
},
'no-console': 'off'
}
},
eslintConfigPrettier,
eslintConfigPrettier
]
6 changes: 3 additions & 3 deletions ghcrawler/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const morgan = require('morgan')
const sendHelper = require('./middleware/sendHelper')

function configureApp(service, logger) {
process.on('unhandledRejection', (exception) => logger.error('unhandledRejection', exception))
process.on('unhandledRejection', exception => logger.error('unhandledRejection', exception))
auth.initialize(config.get('CRAWLER_SERVICE_AUTH_TOKEN') || 'secret', config.get('CRAWLER_SERVICE_FORCE_AUTH'))

const app = express()
Expand Down Expand Up @@ -44,11 +44,11 @@ function configureApp(service, logger) {
// call the callback but with no args. An arg indicates an error.
callback()
},
(error) => {
error => {
console.log(`Service initialization error: ${error.message}`)
console.dir(error)
callback(error)
},
}
)
}

Expand Down
6 changes: 3 additions & 3 deletions ghcrawler/bin/www.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function run(service, logger) {
const server = http.createServer(app)

// initialize the apps (if they have async init functions) and start listening
init(app, (error) => {
init(app, error => {
if (error) {
console.log('Error initializing the Express app: ' + error)
throw new Error(error)
Expand Down Expand Up @@ -105,10 +105,10 @@ function run(service, logger) {
console.log('Server closed.')
process.exit(0)
},
(error) => {
error => {
console.error(`Closing server: ${error}`)
process.exit(1)
},
}
)
}

Expand Down
Loading

0 comments on commit 29fd50a

Please sign in to comment.