Skip to content

Commit

Permalink
Extend indent to changelog files
Browse files Browse the repository at this point in the history
  • Loading branch information
gassmoeller committed Nov 19, 2024
1 parent 06eee5d commit d90acb0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions contrib/utilities/indent
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ find tests include source benchmarks cookbooks unit_tests \
| xargs -P 10 -I {} bash -c "indent_file {}"


# Find all source files that should be checked for invalid characters
# and other unwanted formatting options. This includes more
# files than the ones indented by astyle above (e.g. documentation source
# files). Prints all file names separated by a NULL character (\0).
find_source_files() {
find include source unit_tests cookbooks benchmarks doc \( -name '*.cc' -o -name '*.h' -o -name '*.prm' -o -name '*.h.in' -o -name 'CMakeLists.txt' -o -name '*.cmake' -o -name '*.md' -o -wholename '*modules/changes/*' \) -print0
}
export -f find_source_files

# remove execute permission on source files:
find tests include source benchmarks cookbooks unit_tests \( -name '*.cc' -o -name '*.h' -o -name '*.prm' \) -print | xargs -n 50 -P 10 chmod -x
find_source_files | xargs -0 -n 50 -P 10 chmod -x

# convert dos formatted files to unix file format by stripping out
# carriage returns (15=0x0D):
Expand All @@ -156,7 +165,7 @@ dos_to_unix()
fi
}
export -f dos_to_unix
find tests include source unit_tests cookbooks benchmarks doc \( -name '*.cc' -o -name '*.h' -o -name '*.prm' -o -name '*.h.in' -o -name '*.md' \) -print | xargs -P 10 -I {} bash -c 'dos_to_unix "$@"' _ {}
find_source_files | xargs -0 -P 10 -I {} bash -c 'dos_to_unix "$@"' _ {}

# convert tabs to two spaces:
tab_to_space()
Expand All @@ -169,7 +178,7 @@ tab_to_space()
rm -f $f.tmp
}
export -f tab_to_space
find tests include source unit_tests cookbooks benchmarks doc \( -name '*.cc' -o -name '*.h' -o -name '*.prm' -o -name '*.h.in' -o -name 'CMakeLists.txt' -o -name '*.cmake' -o -name '*.md' \) -print | xargs -P 10 -I {} bash -c 'tab_to_space "$@"' _ {}
find_source_files | xargs -0 -P 10 -I {} bash -c 'tab_to_space "$@"' _ {}

# Remove trailing whitespace from files
remove_trailing_whitespace()
Expand All @@ -182,7 +191,7 @@ remove_trailing_whitespace()
rm -f $f.tmp
}
export -f remove_trailing_whitespace
find tests include source unit_tests cookbooks benchmarks doc \( -name '*.cc' -o -name '*.h' -o -name '*.prm' -o -name '*.h.in' -o -name 'CMakeLists.txt' -o -name '*.cmake' -o -name '*.md' \) -print | xargs -P 10 -I {} bash -c 'remove_trailing_whitespace "$@"' _ {}
find_source_files | xargs -0 -P 10 -I {} bash -c 'remove_trailing_whitespace "$@"' _ {}


# Ensure only a single newline at end of files
Expand All @@ -209,7 +218,7 @@ ensure_single_trailing_newline()
rm -f $f.tmp $f.tmpi
}
export -f ensure_single_trailing_newline
find include source unit_tests cookbooks benchmarks doc \( -name '*.cc' -o -name '*.h' -o -name '*.prm' -o -name '*.h.in' -o -name 'CMakeLists.txt' -o -name '*.cmake' -o -name '*.md' \) -print | xargs -P 10 -I {} bash -c 'ensure_single_trailing_newline "$@"' _ {}
find_source_files | xargs -0 -P 10 -I {} bash -c 'ensure_single_trailing_newline "$@"' _ {}

# Do not recursively search the tests directory for prm files, otherwise the output prms will be changed
find tests \( -name '*.cc' -o -name '*.h' -o -name '*.h.in' -o -name 'CMakeLists.txt' -o -name '*.cmake' \) -print | xargs -P 10 -I {} bash -c 'ensure_single_trailing_newline "$@"' _ {}
Expand Down

0 comments on commit d90acb0

Please sign in to comment.