Commit Graph

10 Commits

Author SHA1 Message Date
Jason Rhinelander
d080f833be Make check-style.sh work on stock macOS
./tools/check-style.sh fails on stock OS X currently; this fixes it:

- use pipes directly rather than exec redirection (macOS's ancient
  version of bash fails with the latter)
- macOS's ancient bash doesn't support '\e' escapes in `echo -e`;
  replace with \033 instead
- BSD grep doesn't support GREP_COLORS, but does allow GREP_COLOR.
  Adding both doesn't hurt GNU grep: GREP_COLOR is deprecated, and won't
  be used when GREP_COLORS is set.
- BSD grep doesn't collapse multiple /'s in the listed filename, so
  failures under `include/` would should up as
  `include//pybind11/whatever.h`.  This removes the / from the include
  directory argument.

Minor other changes:
- The CRLF detection runs with -l, so GREP_COLORS wasn't doing
  anything; removed it.
- The trailing whitespace test would trigger on CRLFs, but the CR would
  result in messed up output.  Changed the test to just match trailing
  spaces and tabs, rather than all whitespace.
2017-06-14 15:19:42 -04:00
Wenzel Jakob
de2c6df200 check-style.sh: check for accidentally committed CRLF line endings 2016-12-13 00:24:08 +01:00
Wenzel Jakob
2b92a49115 updated check-style.sh docs 2016-11-08 10:58:22 +01:00
Wenzel Jakob
cc4efe69c2 more code style checks in Travis CI :) 2016-11-08 10:53:30 +01:00
Wenzel Jakob
fe34241e50 minor doc & style fixes 2016-09-06 13:02:29 +09:00
Wenzel Jakob
85f07e18cc minor code style checker update 2016-09-04 23:00:49 +09:00
Jason Rhinelander
d472f0f058 Add line numbers; show and highlight found tabs
This makes the output considerably easier to use: it now highlights (in
red) matched tabs (instead of just listing the filenames), and adds
line numbers to both the tabs check and the space-less if check outputs.
2016-08-29 21:25:11 -04:00
Jason Rhinelander
5a3570c47c Fix check-style exit status
The check-style exit status wasn't being propagated properly because
the loops were running in a subshell (and so the change the the
`errors` variable wasn't in the active command shell).  This fixes it
by running the greps in subshells and the loops in the main shell.

This also avoids the if(/for(/while( style check on
tests/CMakeLists.txt, since it *does* have if() statements with no space
that are producing error messages, but that is (acceptable) CMake style.
2016-08-29 19:04:12 -04:00
Jason Rhinelander
dbc4bf68ed check-style: also report no space in if(/for(/while( 2016-08-28 14:53:04 -04:00
Jason Rhinelander
ac4278970c Check for tabs instead of spaces in the doc build
This adds a tool that checks style (currently just for tabs instead of
spaces in files under include/tests/docs) and produces a travis-ci build
failure if any problems are found.
2016-08-28 14:11:23 -04:00