OCaml GPR#1148 has been merged this weekend. Contrary to the title of this PR, the most relevant thing for contributors to the compiler itself is that pull requests are now run via our linting tool which resides in tools/check-typo
in the compiler distribution. It produces output like the following:
./asmcomp/selectgen.ml:798.81: [long-line] line is over 80 columns
./asmcomp/selectgen.ml:1129.81: [long-line] line is over 80 columns
./bytecomp/simplif.ml:419.81: [long-line] line is over 80 columns
./bytecomp/symtable.ml:43.3: [white-at-eol] whitespace at end of line
./bytecomp/symtable.ml:62.3: [white-at-eol] whitespace at end of line
./tools/dumpobj.ml:533.81: [long-line] line is over 80 columns
./typing/includemod.ml:167.48: [white-at-eol] whitespace at end of line
./typing/includemod.ml:168.64: [white-at-eol] whitespace at end of line
./typing/includemod.ml:319.81: [long-line] line is over 80 columns
./utils/misc.ml:180.40: [white-at-eol] whitespace at end of line
./utils/misc.mli:105.7: [white-at-eol] whitespace at end of line
It’s necessary for this test to pass (in certain situations it’s possible to override the tests via .gitattributes
, but in general this is not permitted). It’s hoped that this won’t cause too much pain for our wonderful contributors, and, to ease development, that GPR includes a Git pre-commit hook which can be installed to your local Git clone simply by running cp tools/pre-commit-githook .git/hooks/pre-commit
(even on Windows). Once installed, the hook blocks attempts to commit files which are invalid:
[git:git-precommit] C:\DRA\ocaml>git commit -m "GPR#1148 Changes"
./Changes:108.81: [long-line] line is over 80 columns
If you’re in a rush or, perish the thought, there’s a bug in the pre-commit hook, you can always use the --no-verify
flag for git commit
to skip the check-type
test, but bear in mind that Travis will still test it.
Please do report any issues either here, on caml-list or on Mantis.
Happy linted compiler hacking!