blob: 9884ccff291cc13e65469a2097eeed4ca30c4fd2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
const osmBoundarySources = require('./osmBoundarySources.json')
const zoneCfg = require('./timezones.json')
let numErrors = 0
const sourcesUsage = {}
Object.keys(osmBoundarySources).forEach(source => {
sourcesUsage[source] = false
})
Object.keys(zoneCfg).forEach(zone => {
zoneCfg[zone].forEach((operation, idx) => {
if (operation.source === 'overpass') {
// check if source is defined
if (!osmBoundarySources[operation.id]) {
numErrors++
console.error(`No osmBoundarySources config found for entry: ${operation.id}`)
} else {
sourcesUsage[operation.id] = true
}
} else if (operation.source.indexOf('manual') > -1 &&
(!operation.description ||
operation.description.length < 3)) {
numErrors++
console.error(`No description of ${operation.source} for operation ${idx} of zone: ${zone}`)
}
})
})
// check for sources not used in timezone building
Object.keys(sourcesUsage).forEach(source => {
if (!sourcesUsage[source]) {
numErrors++
console.error(`osmBoundarySources config "${source}" is never used in timezone boundary building`)
}
})
if (numErrors > 0) {
console.error(`${numErrors} errors found`)
process.exit(1)
} else {
console.log('No linting errors!')
}
|