Project

General

Profile

Bug #14246

Inconsistent C source code indentation

Added by shyouhei (Shyouhei Urabe) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:84498]

Description

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.


Related issues

Related to Ruby master - Misc #16112: Reduce the possibility of "expand tabs" commit occurrencesClosedActions

Also available in: Atom PDF