blob: 90b402a46991a18e36bd26618cd11912e138626c [file] [log] [blame]
Evan Siroky081c8e42017-05-29 14:53:52 -07001const osmBoundarySources = require('./osmBoundarySources.json')
2const zoneCfg = require('./timezones.json')
3
4let numErrors = 0
5
6const sourcesUsage = {}
7Object.keys(osmBoundarySources).forEach(source => {
8 sourcesUsage[source] = false
9})
10
11Object.keys(zoneCfg).forEach(zone => {
12 zoneCfg[zone].forEach(operation => {
13 if (operation.source === 'overpass') {
14 // check if source is defined
15 if (!osmBoundarySources[operation.id]) {
16 numErrors++
17
18 console.error(`No osmBoundarySources config found for entry: ${operation.id}`)
19 } else {
20 sourcesUsage[operation.id] = true
21 }
22 }
23 })
24})
25
26// check for sources not used in timezone building
27Object.keys(sourcesUsage).forEach(source => {
28 if (!sourcesUsage[source]) {
29 numErrors++
30 console.error(`osmBoundarySources config "${source}" is never used in timezone boundary building`)
31 }
32})
33
34if (numErrors > 0) {
35 console.error(`${numErrors} errors found`)
36 process.exit(1)
37} else {
38 console.log('No linting errors!')
39}