mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/language-data.git
synced 2025-10-04 15:12:29 +08:00
Add basic lint and run it in Travis CI
Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
af525ffa18
commit
a2f378df83
2 changed files with 29 additions and 0 deletions
6
.travis.yml
Normal file
6
.travis.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
dist: xenial
|
||||
language: python
|
||||
python:
|
||||
- "3.7"
|
||||
script:
|
||||
- ./lint
|
23
lint
Executable file
23
lint
Executable file
|
@ -0,0 +1,23 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import csv
|
||||
|
||||
def parse_csv(name):
|
||||
result = {}
|
||||
with open(name, 'r') as csvfile:
|
||||
reader = csv.reader(csvfile, delimiter=';')
|
||||
for data in reader:
|
||||
if data[0] == '#':
|
||||
continue
|
||||
if data[0] in result:
|
||||
raise Exception('Duplicate {} in {}!'.format(data[0], name))
|
||||
result[data[0]] = data
|
||||
return result
|
||||
|
||||
|
||||
languages = parse_csv('languages.csv')
|
||||
aliases = parse_csv('aliases.csv')
|
||||
|
||||
overlap = set(languages.keys()) & set(aliases.keys())
|
||||
if overlap:
|
||||
raise Exception('Overlaping languages and aliases: {}'.format(overlap))
|
Loading…
Add table
Add a link
Reference in a new issue