From: v.ondruch@... Date: 2018-01-05T18:13:15+00:00 Subject: [ruby-core:84653] [Ruby trunk Bug#14246] Inconsistent C source code indentation Issue #14246 has been updated by vo.x (Vit Ondruch). Let me quote Developers How-To [1]: > * indent > * 4 for C > * 2 for Ruby > * tab/space > * Do not use TABs in ruby codes ruby-dev:19388 > * Use TAB instead of 8 SPs in C. (Emacs's default style) [1]: https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto ---------------------------------------- Bug #14246: Inconsistent C source code indentation https://bugs.ruby-lang.org/issues/14246#change-69234 * Author: shyouhei (Shyouhei Urabe) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- I would like to focus on following 238 C source codes in our repository. ``` % git ls-files | grep '\.\(c\|h\|def\)$' | grep -v 'ext|spec|test' | wc -l 238 ``` Here, in these 238 files, 10 files are indented using spaces only. ``` % git ls-files | grep '\.\(c\|h\|def\)$' | grep -v 'ext|spec|test' | \ xargs grep --files-without-match $'^\t' | xargs grep --files-with-match '^ ' | wc -l 10 ``` On the other hand 66 files are indented using tabs. ``` % git ls-files | grep '\.\(c\|h\|def\)$' | grep -v 'ext|spec|test' | \ xargs grep --files-with-match $'^\t' | xargs grep --files-without-match '^ ' | wc -l 66 ``` Other 61 files do not indent. We should not bother them. ``` % git ls-files | grep '\.\(c\|h\|def\)$' | grep -v 'ext|spec|test' | \ xargs grep --files-without-match $'^\t' | xargs grep --files-without-match '^ ' | wc -l 61 ``` So far so good. But what about remaining 101 files? The answer is obvious; these files MIX indents. ``` % git ls-files | grep '\.\(c\|h\|def\)$' | grep -v 'ext|spec|test' | \ xargs grep --files-with-match $'^\t' | xargs grep --files-with-match '^ ' | wc -l 101 ``` This is totally wrong. No matter should we use spaces or tabs for indentations, it must be consistent. -- https://bugs.ruby-lang.org/ Unsubscribe: