From ac4278970c636183f571836ffbbe9be6dab6439d Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Sun, 28 Aug 2016 13:00:44 -0400 Subject: [PATCH] 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. --- .travis.yml | 6 ++++-- tools/check-style.sh | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100755 tools/check-style.sh diff --git a/.travis.yml b/.travis.yml index 4dd3d8e2..23e856c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,9 +38,11 @@ matrix: # Documentation build: - os: linux language: docs - env: DOCS + env: DOCS STYLE install: pip install sphinx sphinx_rtd_theme - script: make -C docs html SPHINX_OPTIONS=-W + script: + - make -C docs html SPHINX_OPTIONS=-W + - tools/check-style.sh cache: directories: - $HOME/.cache/pip diff --git a/tools/check-style.sh b/tools/check-style.sh new file mode 100755 index 00000000..412e67b5 --- /dev/null +++ b/tools/check-style.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Script to check include/test code for common pybind11 code style errors. +# Currently just checks for tabs used instead of spaces. +# +# Invoke as: tools/check-style.sh +# + +found=0 +for f in `grep $'\t' include/ tests/ docs/*.rst -rl`; do + if [ "$found" -eq 0 ]; then + echo -e '\e[31m\e[01mError: found tabs instead of spaces in the following files:\e[0m' + found=1 + fi + + echo " $f" +done + +exit $found