diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2015-12-04 13:14:27 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-12-04 17:31:14 +0100 |
commit | 020375d1e723339a95b86d0d3b8a8214b1cc144a (patch) | |
tree | 6f486d7b056f78c039e3ee4d9e14bf7d5460e67c /.arc-linters | |
parent | d4bf86322a50d5fee550040d15e376fe53ff629b (diff) | |
download | haskell-020375d1e723339a95b86d0d3b8a8214b1cc144a.tar.gz |
Add linter to check for binaries accidentally added to repository
This should catch mistakes like
a703fbce20969e6f02e74fee76c0a9e22b513426.
Adds an arcanist-external-json-linter submodule, which should eventually
be mirrored on haskell.org resources.
Test Plan: Validate
Reviewers: thomie, hvr, austin
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D1515
Diffstat (limited to '.arc-linters')
m--------- | .arc-linters/arcanist-external-json-linter | 0 | ||||
-rwxr-xr-x | .arc-linters/check-binaries.py | 20 |
2 files changed, 20 insertions, 0 deletions
diff --git a/.arc-linters/arcanist-external-json-linter b/.arc-linters/arcanist-external-json-linter new file mode 160000 +Subproject 85ece0f8653e7b1e7de6024d372cfeaf36ab5fa diff --git a/.arc-linters/check-binaries.py b/.arc-linters/check-binaries.py new file mode 100755 index 0000000000..ae007567fa --- /dev/null +++ b/.arc-linters/check-binaries.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +# A linter to warn when binary files are added to the repository + +import sys +import os +import json + +path = sys.argv[1] +warnings = [] +if os.path.isfile(path): + with open(path) as f: + if '\0' in f.read(8000): + warning = { + 'severity': 'warning', + 'message': 'This file appears to be a binary file; does it really belong in the repository?' + } + warnings.append(warning) + +print json.dumps(warnings) |