[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 8311043: Remove trailing blank lines in source files
From:       Daniel D. Daugherty <dcubed () openjdk ! org>
Date:       2023-06-30 15:21:10
Message-ID: 1HPsLLkrre-aTNkUCrJ2Os1Ba20NZW-s3bYL1nJU17Q=.47ea0d5b-f382-48a5-ba1b-957a003277d6 () github ! com
[Download RAW message or body]

On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth <lkorinth@openjdk.org> wrote:

> 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. Thus I will only clean the files. 
> The fix removes trailing lines matching ^[[:space:]]*$ in
> 
> - *.java
> - *.cpp
> - *.hpp
> - *.c
> - *.h 
> 
> I have applied the following bash script to each file:
> 
> file="$1"
> 
> while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do
> truncate -s -1 "$file"
> done
> 
> `git diff --ignore-space-change --ignore-blank-lines  master` displays no changes
> `git diff --ignore-blank-lines  master` displays one change

Ending the file with a blank line? I would not have expected that at all.
I expect a single EOL at the end of the file; from a visual POV, the last
line of non-blank text ends with an EOL. No more, no less.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1614806396


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic