From ffd59a03c0fd42f6fb85ea45734427ab0cca747e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 4 Jan 2021 13:27:12 +1000 Subject: [PATCH] show what's wrong when bad formatting found in ftl --- ftl/format.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ftl/format.py b/ftl/format.py index 73645e3ef..b353578db 100644 --- a/ftl/format.py +++ b/ftl/format.py @@ -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