summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMartin Roth <martin@coreboot.org>2021-02-17 10:52:55 -0700
committerPatrick Georgi <pgeorgi@google.com>2021-02-25 10:03:32 +0000
commit01b5dd60a8710ff505d8add6c181a97ecd329fad (patch)
treef6e5ec3eb8aa64f979eef415f2976dd49cf98257 /util
parent0bb62907eb65788768168d735bce466d743ac393 (diff)
downloadcoreboot-01b5dd60a8710ff505d8add6c181a97ecd329fad.tar.xz
util/lint: Check for windows line endings
The codebase currently has only unix line endings, so add a lint tool to check for windows line endings. BUG=None TEST=Verify that line endings are caught both inside and outside a git repo. Signed-off-by: Martin Roth <martin@coreboot.org> Change-Id: I6faf99a3184e4843640fb8965f8124de0bc52ce7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50851 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Georgi <pgeorgi@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'util')
-rwxr-xr-xutil/lint/lint-stable-026-line-endings20
1 files changed, 20 insertions, 0 deletions
diff --git a/util/lint/lint-stable-026-line-endings b/util/lint/lint-stable-026-line-endings
new file mode 100755
index 0000000000..ec895d144f
--- /dev/null
+++ b/util/lint/lint-stable-026-line-endings
@@ -0,0 +1,20 @@
+#!/usr/bin/env sh
+#
+# SPDX-License-Identifier: GPL-2.0-only
+
+# DESCR: Verify that files don't contain windows line endings
+
+LC_ALL=C export LC_ALL
+
+EXCLUDE='^3rdparty/\|^payloads/external\|^.git'
+
+# Use git grep if the code is in a git repo, otherwise use grep.
+if [ -n "$(command -v git)" ] && \
+ [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]
+then
+ GREP_FILES="git grep -IlP"
+else
+ GREP_FILES="grep -rIlP"
+fi
+
+${GREP_FILES} "\r$" | grep -v "$EXCLUDE"