Re:Tabs or Spaces? The Top Starred Repositories in GitHub An...
by ks on Saturday December 26, 2015 @07:45PM
(#10795911)
Wouldn't this feature be similar to how Git converts line endings?
https://help.github.com/articles/dealing-with-line-endings/
It would probably have to be configured per repo so that it doesn't mess with tab delimited files etc.
Re:Tabs or Spaces? The Top Starred Repositories in GitHub An...
by MichaelGG on Saturday December 26, 2015 @08:04PM
(#10795967)
Auto CrLf is a terrible thing that can change the meaning of programs. Source control shouldn't be changing the contents of files (though a hook to format wouldn't be bad necessarily).
Re:Tabs or Spaces? The Top Starred Repositories in GitHub An...
by smt88 on Saturday December 26, 2015 @09:23PM
(#10796133)
Auto CRLF is awesome for languages I use. Which ones can it change meaning in?
Re:Tabs or Spaces? The Top Starred Repositories in GitHub An...
by MichaelGG on Sunday December 27, 2015 @11:35AM
(#10797881)
Any language that allows string literals to wrap lines without normalizing it. Like C# or F#. Anything with HERE docs might do it, but Ruby and Python seem to normalize.
Re:Tabs or Spaces? The Top Starred Repositories in GitHub An...
by freshhawk on Sunday December 27, 2015 @02:53PM
(#10798531)
But I have seen a solution to this problem, back in subversion days. With help from perl-tidy and php-tidy.
Pre commit hooks, combined with an appropriate *-tidy program for your language. Code is formatted according to the repo tidy config with a pre-commit hook and formatted according to the developers preference on checkout.
I'm missing why whitespace style mapping is not a bijection, you do have to accept some limits to code style in terms of completely rigid indentation rules, and it is obviously language specific. But it seems to be a bijection to me, what am I missing?
Re:Tabs or Spaces? The Top Starred Repositories in GitHub An...
by threatofrain on Sunday December 27, 2015 @01:47AM
(#10796682)
I believe mapping is 1:1 when only the initial indentation is used with tab/space, and further indentation is done with spaces.
Because the mapping from one whitespace style to another is not a bijection. Moreover, our source control tools rely on things like content hashes which change when even a single bit of the source has changed, and sometimes even our language parsers depend on whitespace format.
Frustrating, I know, but you will not see a resolution to this problem with automated tools alone. You will, however, when the Tab key is removed from keyboards altogether :)