Description
Remove trailing "blank" lines in source files.
I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for skara, however it seems jcheck code handling hunks does not track end-of-files.
The fix removes trailing lines matching ^[[:space:]]*$ in gc owned files.
I have applied the following bash script to each file:
`find test/hotspot/jtreg/gc test/hotspot/jtreg/vmTestbase/gc src/hotspot/share/gc -type f | xargs -n 1 clean-script`
```
#!/usr/bin/env bash
# clean-script
set -eu -o pipefail
[[ -v TRACE ]] && set -o xtrace
file="$1"
mime=$(file --brief --mime-type "$file")
if [[ ! "$mime" =~ text/.* ]]; then
echo "excluding file: $file with mime: $mime";
exit 0;
fi
while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do
truncate -s -1 "$file"
done
```
The only non text file in the gc folders was: testcases.jar
and "JDK-8311240 Create testcases.jar from test case" was filed
`git diff --ignore-space-change --ignore-blank-lines master` displays no changes
`git diff --ignore-blank-lines master` displays no changes
I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for skara, however it seems jcheck code handling hunks does not track end-of-files.
The fix removes trailing lines matching ^[[:space:]]*$ in gc owned files.
I have applied the following bash script to each file:
`find test/hotspot/jtreg/gc test/hotspot/jtreg/vmTestbase/gc src/hotspot/share/gc -type f | xargs -n 1 clean-script`
```
#!/usr/bin/env bash
# clean-script
set -eu -o pipefail
[[ -v TRACE ]] && set -o xtrace
file="$1"
mime=$(file --brief --mime-type "$file")
if [[ ! "$mime" =~ text/.* ]]; then
echo "excluding file: $file with mime: $mime";
exit 0;
fi
while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do
truncate -s -1 "$file"
done
```
The only non text file in the gc folders was: testcases.jar
and "
`git diff --ignore-space-change --ignore-blank-lines master` displays no changes
`git diff --ignore-blank-lines master` displays no changes
Attachments
Issue Links
- relates to
-
JDK-8311043 Remove trailing blank lines in source files
- Closed