[BioRuby] Code cleanup: expanded tabs into spaces.

Naohisa Goto ngoto at gen-info.osaka-u.ac.jp
Fri Apr 16 23:28:56 UTC 2010


Hi Anurag,

Please do not replace the tabs inside string literals and
comment lines. These tabs have special meanings.
Tabs in string literals apparently have their own meanings.
Tabs in comments normally do not affect behavior of programs,
but please keep them becase these may be excerption from other
literature, description of data formats using tabs, or some
other intention.

Did you execute all tests before committing? It seems some
tests would fail because of the changes in string literals.
Some functions without tests or uncovered with tests might
be silently broken. It seems parsing Ruby syntax or edit
files by hand may be needed.

Please avoid single big commit. This makes hard if we need
to revert few files due to unexpected regressions.
In this case, because changes in each file are independent
each other, one file one commit would be good. (This is rare
special case. Usually, a commit can contain changes across
two or more files if they are strongly related, e.g. when
we move a method from a file to another, the changes of two
files should be included in a single commit.)

Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org


> I think I have got the solution. Vim seems to expand tab nicely; preserves
> the indentation as well. So I used "vim -c <command> and "find" together to
> do the job. Its a little hackish though.
> 
> find . -name "*.rb" -exec vim -c Retab {} ';' #open a file in vim, run
> :retab, save and quit
> 
> where, Retab command in vim has been defined as:
> 
> :command Retab :call Retab_save_quit() "call the function Retab_save_quit()
> when, Retab command is invoked
> 
> and, retab_save_quit() function was defined as:
> 
> function Retab_save_quit()
>   retab "retab the file
>   wq "save and quit
> end
> 
> with following options set:
> set shiftwidth=2
> set softtabstop=2
> set expandtab
> 
> I disabled my default vimrc to speed up the command, still it took almost
> 1:40 seconds. It had to go through 422 Ruby files :-|.
> 
> I have already disturbed all with a previous pull request :P, so I think I
> should wait for comments first.
> Here is the new diff:
> http://github.com/yeban/bioruby/compare/master...tab_2
> 
> 
> On Sat, Apr 17, 2010 at 2:20 AM, Anurag Priyam <anurag08priyam at gmail.com>wrote:
> 
> > I think because of the different tab sizes used by everyone, I have got the
> > indentation wrong in few files. Replacing tabs at the beginning of the lines
> > also does not work( infact, it destroys indentation in every file). Vim's
> > :retab command seems to work properly though. Please could someone point me
> > in the right direction?
> >
> >
> > On Sat, Apr 17, 2010 at 1:59 AM, Anurag Priyam <anurag08priyam at gmail.com>wrote:
> >
> >> I am unsure if it is needed or not. A simple combination of find and sed
> >> did the job.
> >>
> >> Here is the one liner that I used:
> >> find . -name '*.rb' -exec sed -i 's/\t/        /g' {} ';'
> >>
> >> A patch would have been too long, so I have sent a pull request on github
> >> for review.
> >>
> >> Diff:
> >> http://github.com/yeban/bioruby/compare/master...tab
> >>
> >> --
> >> Anurag Priyam
> >> 2nd Year,Mechanical Engineering,
> >> IIT Kharagpur.
> >> +91-9775550642
> >>
> >
> >
> >
> > --
> > Anurag Priyam
> > 2nd Year,Mechanical Engineering,
> > IIT Kharagpur.
> > +91-9775550642
> >
> 
> 
> 
> -- 
> Anurag Priyam
> 2nd Year,Mechanical Engineering,
> IIT Kharagpur.
> +91-9775550642
> _______________________________________________
> BioRuby Project - http://www.bioruby.org/
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby

-- 
Naohisa Goto <ngoto at gen-info.osaka-u.ac.jp>




More information about the BioRuby mailing list