From 7416aa0d8eda74e336cabd98a2208185f46ae871 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 16 Jan 2020 10:17:46 -0700 Subject: [PATCH] Add script --- contrib/utilities/indent | 7 +++++++ contrib/utilities/indent-all | 7 +++++++ contrib/utilities/indent_common.sh | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/contrib/utilities/indent b/contrib/utilities/indent index 0034b4db1a..aa6a54201a 100755 --- a/contrib/utilities/indent +++ b/contrib/utilities/indent @@ -68,3 +68,10 @@ process_changed "tests include source examples contrib/python-bindings" \ process_changed "tests include source examples contrib/python-bindings" \ ".*\.(cc|h|cu|cuh|inst.in|cmake)" dos_to_unix + +# +# Removing trailing whitespace +# + +process_changed "include source examples contrib/python-bindings doc" \ + ".*\.(cc|h|cu|cuh|html|dox|txt)" remove_trailing_whitespace diff --git a/contrib/utilities/indent-all b/contrib/utilities/indent-all index 0f4e5b3fa1..b5d5450d91 100755 --- a/contrib/utilities/indent-all +++ b/contrib/utilities/indent-all @@ -72,3 +72,10 @@ process "tests include source examples contrib/python-bindings" \ process "tests include source examples contrib/python-bindings" \ ".*\.(cc|h|cu|cuh|inst.in|cmake)" dos_to_unix + +# +# Removing trailing whitespace +# + +process "include source examples contrib/python-bindings doc" \ + ".*\.(cc|h|cu|cuh|html|dox|txt)" remove_trailing_whitespace diff --git a/contrib/utilities/indent_common.sh b/contrib/utilities/indent_common.sh index 43b3eaeb30..d9c82e72d9 100644 --- a/contrib/utilities/indent_common.sh +++ b/contrib/utilities/indent_common.sh @@ -162,6 +162,16 @@ format_file() } export -f format_file +# +# Remove trailing whitespace +# + +remove_trailing_whitespace() +{ + sed -i 's/\s\+$//g' $1 +} +export -f remove_trailing_whitespace + # # In order to format .inst.in files, we need to replace \{ and \} by a # sentinel because clang-format happily strips away the backslash. Further, -- 2.39.5