mirror of
https://github.com/ankitects/anki.git
synced 2026-01-14 06:23:57 -05:00
show what's wrong when bad formatting found in ftl
This commit is contained in:
parent
b87b32f2ea
commit
28f1661ac1
1 changed files with 12 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import os
|
|||
import json
|
||||
import glob
|
||||
import sys
|
||||
import difflib
|
||||
from typing import List
|
||||
from fluent.syntax import parse, serialize
|
||||
from fluent.syntax.ast import Junk
|
||||
|
|
@ -64,6 +65,17 @@ def check_file(path: str, fix: bool) -> bool:
|
|||
return True
|
||||
else:
|
||||
print(f"Bad formatting in {path}")
|
||||
print(
|
||||
"\n".join(
|
||||
difflib.unified_diff(
|
||||
orig_text.splitlines(),
|
||||
new_text.splitlines(),
|
||||
fromfile="bad",
|
||||
tofile="good",
|
||||
lineterm="",
|
||||
)
|
||||
)
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue