lpereira / hardinfo

System profiler and benchmark tool for Linux systems
http://hardinfo.org
GNU General Public License v2.0
768 stars 130 forks source link

Use spaces for indentation throughout #102

Open bp0 opened 7 years ago

bp0 commented 7 years ago

As mentioned in #33 (a conversation that went way off-topic), the code uses a mix of spaces and tabs for indentation. I prefer spaces, so I've been using spaces in all new code, and converting old code that I edit.

tabspace

Status

Checked means cleaned. Uses all spaces (or tabs, but not a mix) for indentation; has no whitespace on empty lines. (as of 8e4746423c20b525671998b1bc94b3b6d8ec78d6)

mckaygerhard commented 7 years ago

i have a pull #94 that said 4 spaces for identation, will be or 8 or other? will be a mixure of or only SPACES?

bp0 commented 7 years ago

I use 4, but whatever looks nice where it is used. If the pyramid is getting big, perhaps only use 2 for that block. Doesn't need to be a hard rule.

lpereira commented 7 years ago

Might be better to just use clang-format throghout.

mckaygerhard commented 7 years ago

so well? clang-format have several style options, might be difficult to determine prefered.. https://clang.llvm.org/docs/ClangFormatStyleOptions.html

due that you can put after merged or here what might be in the CONTRIBUTING.md file of pull #95

bp0 commented 7 years ago

clang-format is kindof nice, but there are a couple problems with hardinfo. For example: https://github.com/lpereira/hardinfo/blob/master/modules/devices/x86/processor.c#L386 clang-format squishes it all into one giant block of parameters to the printf.

I think clang-format could be useful, but I don't think running it on the whole tree is a good idea.

Here is a candidate .clang-format

BasedOnStyle:  LLVM
IndentWidth:     4
ColumnLimit:     100
TabWidth:        8
UseTab:          Never
AlignEscapedNewlines: Left
AlwaysBreakAfterReturnType: None
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
mckaygerhard commented 7 years ago

jaja that's geany right?

well in my pull's now i'll use 4 spaces for identation and the clang-format columnwith 100 and AllowShortBlocksOnASingleLine but my "if-else" always be not singleline due consistence coding, i think no problem for us that due are not so dangerous to eyes!