css linter: Fix error reporting.

Three changes:
    * Change wording of error message.
    * Flush standard error.
    * Use unified diff.
This commit is contained in:
Steve Howell
2018-01-03 13:22:59 -05:00
parent f620525373
commit a49fd44612

View File

@@ -14,9 +14,13 @@ def validate(fn):
text = open(fn).read() text = open(fn).read()
section_list = parse(text) section_list = parse(text)
if text != section_list.text(): if text != section_list.text():
print('%s seems to be broken:' % (fn,)) sys.stderr.write('''
FAIL: {} is being rejected by our finicky linter)
(you can manually apply the diff to fix)\n\n'''.format(fn,))
sys.stderr.flush()
open('/var/tmp/pretty_css.txt', 'w').write(section_list.text()) open('/var/tmp/pretty_css.txt', 'w').write(section_list.text())
subprocess.call(['diff', fn, '/var/tmp/pretty_css.txt'], stderr=subprocess.STDOUT) subprocess.call(['diff', '-u', fn, '/var/tmp/pretty_css.txt'], stderr=subprocess.STDOUT)
sys.exit(1) sys.exit(1)
def check_our_files(filenames): def check_our_files(filenames):