From: "shyouhei (Shyouhei Urabe)" Date: 2022-06-27T00:28:31+00:00 Subject: [ruby-core:109057] [Ruby master Bug#14246] Inconsistent C source code indentation Issue #14246 has been updated by shyouhei (Shyouhei Urabe). ioquatix (Samuel Williams) wrote in #note-16: > Does this policy apply to the formatting of default gems too? I don't think so. One good thing about splitting things into gems is they can have their own policies (release timing etc.). I support each gems having distinct point of view as to what code is a beautiful code. ---------------------------------------- Bug #14246: Inconsistent C source code indentation https://bugs.ruby-lang.org/issues/14246#change-98203 * Author: shyouhei (Shyouhei Urabe) * Status: Closed * Priority: Normal * 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: