tmLQCD icon indicating copy to clipboard operation
tmLQCD copied to clipboard

Consistent indentation rules

Open kostrzewa opened this issue 12 years ago • 10 comments

I've been wanting to bring this up for a while now because it makes code much easier to read for everyone. Could we please agree to consistent rules for indendation? Personally, I'm partial to 2 spaces, no tabs. It is a sufficiently big indent to clearly separate levels while beeing conservative in regards to horizontal space. With a good editor using spaces instead of tabs is really not annoying at all.

The only drawback (in my opinion) comes from editing makefiles where one needs to use real tabs for the rules of a target. However, these can be produced by entering "verbatim mode" in VI(M), for instance.

f(in) {
  int n;
  n = in;
}

kostrzewa avatar Jan 25 '13 10:01 kostrzewa

who is using tabs?

urbach avatar Jan 25 '13 13:01 urbach

I've found a few of your routines which had a mixture of spaces and tabs. See for instance ndrat_monomial.c line 104. There are three tabs to begin with and then five spaces.

In other instances horizontal aligment is really bad as a consequence.

kostrzewa avatar Jan 25 '13 13:01 kostrzewa

Im always using xemacs for indentation, so no idea where the tabs come from. Usually xemacs does it with spaces.

urbach avatar Jan 25 '13 14:01 urbach

How about we create an astyle file and commit it? There's probably going to be instances of broken indentation conventions afterwards, but it'll be easy to fix at least. With SVN, there used to be the issue that any file visited by astyle would be marked as modified, but it shouldn't be an issue with git.

deuzeman avatar Feb 06 '13 15:02 deuzeman

Now that we have a .clang-format file in master, this issue is resolved, right?

We could add a local .vimrc which sets a couple of options such that the local style does not deviate much from what clang-format would give us:

set shiftwidth=2
set tabstop=2
set softtabstop=2

set colorcolumn=100

Then developers would have to have set exrc in their ~/.vim/vimrcin order to use the project.vimrc`.

martin-ueding avatar Apr 22 '17 15:04 martin-ueding

we have a .clang-format file in master?

remark: I'm personally often using emacs.

urbach avatar Apr 23 '17 17:04 urbach

My mistake, the .clang-format is only in qphix_devel.

I'll add that .vimrc then locally for me only, no need to pollute the repository.

martin-ueding avatar Apr 23 '17 17:04 martin-ueding

but it would be good to have one for master as well!

urbach avatar Apr 25 '17 09:04 urbach

.clang-format will be merged with qphix

kostrzewa avatar Apr 25 '17 11:04 kostrzewa

I would prefer to not have the tmLQCD code-base take over my vim settings.

kostrzewa avatar Apr 25 '17 11:04 kostrzewa