etmc / tmLQCD

tmLQCD is a freely available software suite providing a set of tools to be used in lattice QCD simulations. This is mainly a HMC implementation (including PHMC and RHMC) for Wilson, Wilson Clover and Wilson twisted mass fermions and inverter for different versions of the Dirac operator. The code is fully parallelised and ships with optimisations for various modern architectures, such as commodity PC clusters and the Blue Gene family.
http://www.itkp.uni-bonn.de/~urbach/software.html
GNU General Public License v3.0
32 stars 47 forks source link

Consistent indentation rules #220

Open kostrzewa opened 11 years ago

kostrzewa commented 11 years ago

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;
}
urbach commented 11 years ago

who is using tabs?

kostrzewa commented 11 years ago

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.

urbach commented 11 years ago

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

deuzeman commented 11 years ago

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.

martin-ueding commented 7 years ago

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`.

urbach commented 7 years ago

we have a .clang-format file in master?

remark: I'm personally often using emacs.

martin-ueding commented 7 years ago

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.

urbach commented 7 years ago

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

kostrzewa commented 7 years ago

.clang-format will be merged with qphix

kostrzewa commented 7 years ago

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