Issue #14246 has been updated by duerst (Martin Drst).


I'm all for better consistency. I thought there were clear guidelines for Ruby, and (almost) everybody was following them. I didn't know it was that bad.

But fixing spacing will obscure where the code originally came from. I don't really like that.

To improve the situation, I have the following suggestions:

1) Install an SVN bot that fixes indents on newly committed lines automatically. That would hopefully catch the attention of the committers.

2) Based on `svn blame`, get a picture of who is how good (or not) at following the guidelines, and gently nudge everybody in the right direction.

[Somebody sooner or later will start discussion on what the best way of indenting should be. If you want to do this, please make it a separate issue. Please tag it as "joke" (because we don't have a "bikeshed" category).]

----------------------------------------
Bug #14246: Inconsistent C source code indentation
https://bugs.ruby-lang.org/issues/14246#change-69025

* 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 | command 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 | command 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 | command 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 | command 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>