From 469c4a106be39c7d5275a37bba7e189ef9449761 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 3 Nov 2016 14:33:17 -0700 Subject: [PATCH] Fix and create code-smell test for line endings. --- docsite/_static/solar.css | 22 +++++++++++----------- test/sanity/code-smell/line-endings.sh | 12 ++++++++++++ test/utils/shippable/code-smell.sh | 1 + 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100755 test/sanity/code-smell/line-endings.sh diff --git a/docsite/_static/solar.css b/docsite/_static/solar.css index 15b5adef71a..fb4d1608dd2 100644 --- a/docsite/_static/solar.css +++ b/docsite/_static/solar.css @@ -174,11 +174,11 @@ h3 { h3, h4, h5, h6 { color: #073642; - border-bottom: 1px dotted #eee; + border-bottom: 1px dotted #eee; } div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a { - color: #657B83!important; + color: #657B83!important; } h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor { @@ -214,8 +214,8 @@ a.headerlink:hover { cite, code, tt { - font-family: 'Source Code Pro', monospace; - font-size: 0.9em; + font-family: 'Source Code Pro', monospace; + font-size: 0.9em; letter-spacing: 0.01em; background-color: #eeeff2; font-style: normal; @@ -233,17 +233,17 @@ hr { } pre { - font-family: 'Source Code Pro', monospace; + font-family: 'Source Code Pro', monospace; font-style: normal; - font-size: 0.9em; + font-size: 0.9em; letter-spacing: 0.015em; line-height: 120%; padding: 0.7em; - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ } pre a { diff --git a/test/sanity/code-smell/line-endings.sh b/test/sanity/code-smell/line-endings.sh new file mode 100755 index 00000000000..4d8b5f3849a --- /dev/null +++ b/test/sanity/code-smell/line-endings.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +grep -RIPl '\r' . 2>/dev/null \ + --exclude-dir .git \ + | grep -v -F \ + -e './test/integration/targets/win_regmerge/templates/win_line_ending.j2' + +if [ $? -ne 1 ]; then + printf 'One or more file(s) listed above have invalid line endings.\n' + printf 'Make sure all files use "\\n" for line endings instead of "\\r\\n".\n' + exit 1 +fi diff --git a/test/utils/shippable/code-smell.sh b/test/utils/shippable/code-smell.sh index 2ad834c3222..ab5a555d3ad 100755 --- a/test/utils/shippable/code-smell.sh +++ b/test/utils/shippable/code-smell.sh @@ -21,6 +21,7 @@ test/sanity/code-smell/use-compat-six.sh lib test/sanity/code-smell/boilerplate.sh test/sanity/code-smell/required-and-default-attributes.sh test/sanity/code-smell/shebang.sh +test/sanity/code-smell/line-endings.sh shellcheck \ test/integration/targets/*/*.sh \