Re: [Yade-dev] Removing trailing white space, yay or nay?
It’s a great idea. And I’m surprised how personal it is for me :) Code readability is top priority for me. I’m sure we will find the clang-format settings which suits us. Automatic checks if the recently touched files (e.g files from the current MR) were reformatted will definitely help us. At first this will add some unreadable diffs. But later it will be a refreshing breeze :) -- Janek Kozicki On 17 Oct 2019, 18:59 +0200, Anton Gladky , wrote: > Hi, > > I propose to use the clang-format [1], which automatically formats > the code according to the pre-defined rules. It has a nice support > by most of IDEs and can also be used through command line. > > There are some pre-defined styles (LLVM, Google, Chromium, Mozilla, WebKit), > and i think we just need to choose. Fine-tuning is also possible, but > it is not necessary. > > Running this tool recursively all over the code is possible, but can produce > a large, not reviewable diff. But formatting the files, touched during > development process can step-by-step fix most parts of the code and be > consistent in the future. > > I have prepared a WIP-merge request [2], where the .clang-format file is added > and the Scene.cpp was reformatted using this tool. So you can check, > whether it will work for us. Style format can be changed, but it looks like > LLVM-style will produce the minimal changes. > > Pipelines can also check, whether the committer formatted the code > with clang-format. At the end we will forget the formatting problem in Yade. > > Generally, I have a good experience with this tool and I hope it can > work for this project as well. Comments are welcome. > > [1] https://clang.llvm.org/docs/ClangFormat.html > [2] https://gitlab.com/yade-dev/trunk/merge_requests/298 > > Regards > > > Anton > > ___ > Mailing list: https://launchpad.net/~yade-dev > Post to : yade-dev@lists.launchpad.net > Unsubscribe : https://launchpad.net/~yade-dev > More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp
Re: [Yade-dev] Removing trailing white space, yay or nay?
Hi, I propose to use the clang-format [1], which automatically formats the code according to the pre-defined rules. It has a nice support by most of IDEs and can also be used through command line. There are some pre-defined styles (LLVM, Google, Chromium, Mozilla, WebKit), and i think we just need to choose. Fine-tuning is also possible, but it is not necessary. Running this tool recursively all over the code is possible, but can produce a large, not reviewable diff. But formatting the files, touched during development process can step-by-step fix most parts of the code and be consistent in the future. I have prepared a WIP-merge request [2], where the .clang-format file is added and the Scene.cpp was reformatted using this tool. So you can check, whether it will work for us. Style format can be changed, but it looks like LLVM-style will produce the minimal changes. Pipelines can also check, whether the committer formatted the code with clang-format. At the end we will forget the formatting problem in Yade. Generally, I have a good experience with this tool and I hope it can work for this project as well. Comments are welcome. [1] https://clang.llvm.org/docs/ClangFormat.html [2] https://gitlab.com/yade-dev/trunk/merge_requests/298 Regards Anton ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp
Re: [Yade-dev] Removing trailing white space, yay or nay?
I remove trailing whitespace at the end of the line, provided that I am changing this line for some *other* purpose. I prefer to avoid changing lines only for the sake of formatting, because that will eventually cause unwanted and unnecessary merge conflicts later. Also I tend to add a newline at the end of file if such newline is missing. That’s only because ’git diff’ shows warnings about the lack of these. In fact ‘git diff’ also complains about trailing whitespaces by printing them in red. It makes it simpler to remove them ;) -- Janek Kozicki On 17 Oct 2019, 11:05 +0200, Robert Caulk , wrote: > Hey yade devs, > > Lately I’ve been letting my editor automatically remove trailing white space > in the files I’m working on. The benefit to doing this can be disputed, but > it seems most people agree that trailing white space is undesirable because > it can create unwanted commit noise and interfere with other developers quick > keys [1]. A Couple other benign reasons highlighted in that thread: > > • It takes more storage space than necessary > • The parser will have to skip an extra character for no good reason when > compiling > • Some editors might add an extra blank line when WordWrap is on and the > trailing space doesn't fit > • It feels like the cursor is hanging in thin air at the end of a line, every > step to the right may cause it to either drop or to hover further to an > unknown extent, it just feels unsteady (like those invisible or disappearing > blocks that Super Mario used to jump on). > > > But clearly the first commit on a file where existing trailing white space is > removed is also going to look excessive and polluted [2]... > > I will follow the majority opinion in our community on keeping or > progressively doing away with trailing white space. Thoughts? > > Cheers, > > Robert > > [1]https://softwareengineering.stackexchange.com/questions/121555/why-is-trailing-whitespace-a-big-deal > [2]https://gitlab.com/yade-dev/trunk/merge_requests/296/diffs?diff_id=59111225_sha=bfa40d9617c0c3f03c5d8eaddfd52d4c075f2781#65534ad2321a960558c286a3a64b1c38fb17f52c > ___ > Mailing list: https://launchpad.net/~yade-dev > Post to : yade-dev@lists.launchpad.net > Unsubscribe : https://launchpad.net/~yade-dev > More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp
[Yade-dev] Removing trailing white space, yay or nay?
Hey yade devs, Lately I’ve been letting my editor automatically remove trailing white space in the files I’m working on. The benefit to doing this can be disputed, but it seems most people agree that trailing white space is undesirable because it can create unwanted commit noise and interfere with other developers quick keys [1]. A Couple other benign reasons highlighted in that thread: - It takes more storage space than necessary - The parser will have to skip an extra character for no good reason when compiling - Some editors might add an extra blank line when WordWrap is on and the trailing space doesn't fit - It feels like the cursor is hanging in thin air at the end of a line, every step to the right may cause it to either drop or to hover further to an unknown extent, it just feels unsteady (like those invisible or disappearing blocks that Super Mario used to jump on). But clearly the first commit on a file where existing trailing white space is removed is also going to look excessive and polluted [2]... I will follow the majority opinion in our community on keeping or progressively doing away with trailing white space. Thoughts? Cheers, Robert [1] https://softwareengineering.stackexchange.com/questions/121555/why-is-trailing-whitespace-a-big-deal [2] https://gitlab.com/yade-dev/trunk/merge_requests/296/diffs?diff_id=59111225_sha=bfa40d9617c0c3f03c5d8eaddfd52d4c075f2781#65534ad2321a960558c286a3a64b1c38fb17f52c ___ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp