Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Dec 7, 2023
1 parent 08e03b0 commit 65fdbbf
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout last commit
uses: actions/checkout@v4
- name: Check format
run: python check.py
23 changes: 23 additions & 0 deletions check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import re

with open('stroke.dict.yaml') as file:
lines = file.readlines()

item2line: dict[tuple[str, str], int] = {}

start = lines.index('...\n') + 1

for i, line in enumerate(lines[start:], start=start+1):
line = line.rstrip()
if not line or line.startswith('#'):
continue
match = re.match(r'(\S+)\t(\S+)', line)
if not match:
print(f'Syntax error at line {i}')
exit(1)
key = (match.group(1), match.group(2))
n = item2line.get(key)
if n:
print(f'Duplicated definition at line {n} and {i}: {line}')
exit(1)
item2line[key] = i

0 comments on commit 65fdbbf

Please sign in to comment.