diff options
m--------- | .arc-linters/arcanist-external-json-linter | 0 | ||||
-rwxr-xr-x | .arc-linters/check-binaries.py | 20 | ||||
-rw-r--r-- | .arcconfig | 6 | ||||
-rw-r--r-- | .arclint | 4 | ||||
-rw-r--r-- | .gitmodules | 3 |
5 files changed, 32 insertions, 1 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) diff --git a/.arcconfig b/.arcconfig index b9c39321ed..c886789d35 100644 --- a/.arcconfig +++ b/.arcconfig @@ -1,5 +1,9 @@ { "project.name" : "ghc", "repository.callsign" : "GHC", - "phabricator.uri" : "https://phabricator.haskell.org" + "phabricator.uri" : "https://phabricator.haskell.org", + + "load": [ + ".arc-linters/arcanist-external-json-linter" + ] } @@ -52,6 +52,10 @@ "severity": { "2": "disabled" } + }, + "check-binaries": { + "type": "external-json", + "external-json.script": "python .arc-linters/check-binaries.py" } }, diff --git a/.gitmodules b/.gitmodules index 662f6d6c14..0d88e017d7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -115,3 +115,6 @@ path = libffi-tarballs url = ../libffi-tarballs.git ignore = none +[submodule ".arc-linters/arcanist-external-json-linter"] + path = .arc-linters/arcanist-external-json-linter + url = https://github.com/bgamari/arcanist-external-json-linter.git |