diff options
m--------- | .arc-linters/arcanist-external-json-linter | 0 | ||||
-rwxr-xr-x | .arc-linters/check-binaries.py | 20 | ||||
-rwxr-xr-x | .arc-linters/check-cpp.py | 91 | ||||
-rw-r--r-- | .arc-linters/check-makefiles.py | 27 | ||||
-rw-r--r-- | .arcconfig | 10 | ||||
-rw-r--r-- | .arclint | 125 | ||||
-rw-r--r-- | .gitmodules | 3 |
7 files changed, 0 insertions, 276 deletions
diff --git a/.arc-linters/arcanist-external-json-linter b/.arc-linters/arcanist-external-json-linter deleted file mode 160000 -Subproject 957f9e4e8eb422dcb72f02f07767a1ed5969baa diff --git a/.arc-linters/check-binaries.py b/.arc-linters/check-binaries.py deleted file mode 100755 index 017b89bff0..0000000000 --- a/.arc-linters/check-binaries.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python3 - -# 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, 'rb') as f: - if b'\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/.arc-linters/check-cpp.py b/.arc-linters/check-cpp.py deleted file mode 100755 index a442e261db..0000000000 --- a/.arc-linters/check-cpp.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python3 - -# A linter to warn for ASSERT macros which are separated from their argument -# list by a space, which Clang's CPP barfs on - -import sys -import logging -import os -import re -import json - -def setup_logging(logger): - """ - ``arc lint`` makes it quite tricky to catch debug output from linters. - Log to a file to work around this. - """ - hdlr = logging.FileHandler('linter.log', 'w') - logger.addHandler(hdlr) - logger.setLevel(logging.DEBUG) - return logger - -logger = logging.getLogger() -#setup_logging(logger) -logger.debug(sys.argv) - -def add_warning(severity, message, line): - entry = { - 'severity': severity, - 'message': message, - 'line': line - } - warnings.append(entry) - -class Linter(object): - def __init__(self): - self.warnings = [] - - def add_warning(self, **entry): - self.warnings.append(entry) - - def lint(self, path): - pass - -class LineLinter(Linter): - def lint(self, path): - if os.path.isfile(path): - with open(path, 'rb') as f: - for lineno, line in enumerate(f): - self.lint_line(lineno+1, line) - - def lint_line(self, lineno, line): - pass - -class RegexpLinter(LineLinter): - def __init__(self, regex, **warning): - LineLinter.__init__(self) - self.re = re.compile(regex) - self.warning = warning - - def lint_line(self, lineno, line): - if self.re.search(line): - warning = { - 'line': lineno, - } - warning.update(self.warning) - self.add_warning(**warning) - -linters = [ - RegexpLinter(br'ASSERT\s+\(', - message='CPP macros should not have a space between the macro name and their argument list'), - RegexpLinter(br'#ifdef\s+', - message='`#if defined(x)` is preferred to `#ifdef x`', - severity='warning'), - RegexpLinter(br'#if\s+defined\s+', - message='`#if defined(x)` is preferred to `#if defined x`', - severity='warning'), - RegexpLinter(br'#ifndef\s+', - message='`#if !defined(x)` is preferred to `#ifndef x`', - severity='warning'), -] - -if __name__ == '__main__': - path = sys.argv[1] - for linter in linters: - linter.lint(path) - - warnings = [warning - for linter in linters - for warning in linter.warnings] - logger.debug(warnings) - print(json.dumps(warnings)) diff --git a/.arc-linters/check-makefiles.py b/.arc-linters/check-makefiles.py deleted file mode 100644 index 4778b2d51a..0000000000 --- a/.arc-linters/check-makefiles.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python3 - -# Warn for use of `--interactive` inside Makefiles (#11468). -# -# Encourage the use of `$(TEST_HC_OPTS_INTERACTIVE)` instead of -# `$(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0`. It's too easy to -# forget one of those flags when adding a new test. - -import sys -import os -import json -import re - -path = sys.argv[1] -warnings = [] -if os.path.isfile(path): - with open(path) as f: - for lineno, line in enumerate(f): - if '--interactive' in line: - warning = { - 'severity': 'warning', - 'message': 'Use `$(TEST_HC_OPTS_INTERACTIVE)` instead of `--interactive -ignore-dot-ghci -v0`', - 'line': lineno+1, - } - warnings.append(warning) - -print(json.dumps(warnings)) diff --git a/.arcconfig b/.arcconfig deleted file mode 100644 index 29021b3108..0000000000 --- a/.arcconfig +++ /dev/null @@ -1,10 +0,0 @@ -{ - "project.name" : "ghc", - "repository.callsign" : "GHC", - "phabricator.uri" : "https://phabricator.haskell.org", - "base" : "git:merge-base(origin/master), arc:prompt", - - "load": [ - ".arc-linters/arcanist-external-json-linter" - ] -} diff --git a/.arclint b/.arclint deleted file mode 100644 index 95355e2898..0000000000 --- a/.arclint +++ /dev/null @@ -1,125 +0,0 @@ -{ - "linters": { - "filename": { - "type": "filename" - }, - "generated": { - "type": "generated" - }, - "merge-conflict": { - "type": "merge-conflict", - "exclude": "(\\.rst$)" - }, - "nolint": { - "type": "nolint" - }, - "haskell": { - "type": "text", - "include": ["(\\.(l?hs(-boot)?|x|y\\.pp)(\\.in)?$)"], - "severity": { - "5": "disabled", - "2": "warning" - } - }, - "c": { - "type": "text", - "include": ["(\\.(c|h)(\\.in)?$)"], - "severity": { - "2": "warning" - } - }, - "text-xml": { - "type": "text", - "include": "(\\.xml$)", - "severity": { - "5": "disabled", - "3": "disabled", - "2": "warning" - } - }, - "shell": { - "type": "text", - "include": [ "(\\.sh$)" ], - "text.max-line-length": 200, - "severity": { - "2": "warning" - } - }, - "makefiles": { - "type": "text", - "include": [ "(Makefile$)", "(\\.mk$)" ], - "text.max-line-length": 400, - "severity": { - "2": "disabled" - } - }, - "cabal": { - "type": "text", - "include": ["(\\.cabal(\\.in)?$)"], - "severity": { - "5": "disabled", - "2": "warning" - } - }, - "other-text": { - "type": "text", - "include": ["(.travis.yml?)", "(.md$)", "(.txt$)"], - "severity": { - "5": "disabled", - "2": "warning" - } - }, - "check-binaries": { - "type": "external-json", - "external-json.script": "python3 .arc-linters/check-binaries.py" - }, - "check-makefiles": { - "type": "external-json", - "include": ["(Makefile$)"], - "external-json.script": "python3 .arc-linters/check-makefiles.py" - }, - "bad-assert-clang-cpp": { - "type": "external-json", - "include": ["(\\.(l?hs|x|y\\.pp)(\\.in)?$)", "(\\.(c|h)$)"], - "external-json.script": "python3 .arc-linters/check-cpp.py" - } - }, - - "exclude": - [ "(^libffi-tarballs)", - "(^libraries/binary)", - "(^libraries/bytestring)", - "(^libraries/Cabal)", - "(^libraries/containers)", - "(^libraries/haskeline)", - "(^libraries/pretty)", - "(^libraries/terminfo)", - "(^libraries/transformers)", - "(^libraries/xhtml)", - "(^libraries/Win32)", - "(^libraries/primitive)", - "(^libraries/vector)", - "(^libraries/time)", - "(^libraries/random)", - "(^libraries/array)", - "(^libraries/deepseq)", - "(^libraries/directory)", - "(^libraries/filepath)", - "(^libraries/haskell98)", - "(^libraries/haskell2010)", - "(^libraries/hoopl)", - "(^libraries/hpc)", - "(^libraries/old-locale)", - "(^libraries/old-time)", - "(^libraries/process)", - "(^libraries/unix)", - "(^libraries/parallel)", - "(^libraries/stm)", - "(^libraries/dph)", - "(^utils/haddock)", - "(^nofib)", - "(^utils/hsc2hs)", - "(^libffi-tarballs)", - "(^ghc-tarballs)" - ] -} diff --git a/.gitmodules b/.gitmodules index 5700a96a22..4de91b60f1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -107,6 +107,3 @@ [submodule "gmp-tarballs"] path = libraries/integer-gmp/gmp/gmp-tarballs url = ../gmp-tarballs.git -[submodule ".arc-linters/arcanist-external-json-linter"] - path = .arc-linters/arcanist-external-json-linter - url = ../arcanist-external-json-linter.git |