-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add ci that is supposed to fail * fix 安道爾
- Loading branch information
1 parent
d71cde6
commit a18b099
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | ||
- name: Check format | ||
run: python check.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import re | ||
|
||
errors: list[tuple[str, int, str]] = [] | ||
|
||
for name in ('emoji_category.txt', 'emoji_word.txt'): | ||
with open(f'opencc/{name}') as file: | ||
lines = file.readlines() | ||
for i, line in enumerate(lines): | ||
match = re.match(r'(\S+)\t(\S+)( \S+)+', line) | ||
if not match or match.group(1) != match.group(2): | ||
errors.append((name, i + 1, line[:-1] if line.endswith('\n') else line)) | ||
|
||
if errors: | ||
print('Format error') | ||
for error in errors: | ||
print(f'{error[0]}:{error[1]} {error[2]}') | ||
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters