Recently we took the first step towards a more consistent coding style
in HCATALOG-486, where we added a small number of check style rules,
and the associated reformat to make the checks pass. There's a balance
between enforcing lots of style rules vs. annoying developers that we
need to be mindful of, and find the balance that works for us.

There are some guidelines listed in the wiki here, which clearly state
4-space indentation. That said, I see a lot of classes use 2-space
indentation, and I'm certainly guilty of using 2-spaces for new files
I've added because I like that better. But really we should follow the
style rules instead of imposing our preferences.

    
https://cwiki.apache.org/confluence/display/HCATALOG/HowToContribute#HowToContribute-MakingChanges

If we do want to move towards enforcing consistent indentation I think
there's a lot of risk of accidental issues by simply doing a bulk
reformat. Instead we might:

- add a checkstyle rule that requires 4 space indentations
- exclude all the existing files from the rule

Over time if someone wants to spend the time we can reformat existing
files as no-op changes, and remove the files from the exclude list.

Thoughts? I think moving towards a consistent style is important but
hope we can find a good balance between letting people code the way
they like to vs. imposing lots of rules.

--travis



On Wed, Sep 5, 2012 at 3:57 PM, Chris Drome <[email protected]> wrote:
> I had commented to Francis about this a couple of weeks ago.
>
> It seems like the Alan Gates specified 4 spaces, but some contributors are
> using 2 spaces instead.
>
>
> On 9/5/12 3:55 PM, "Arup Malakar" <[email protected]> wrote:
>
>>Hi,
>>
>>I see that some of the classes (~81 classes) in the codebase use 2
>>spaces for indentation. Rest
>>of the codebase (~67 classes) use 4 spaces for indentation. Having a
>>consistent coding style makes
>>it easier to read as well to change the code.
>>
>>If we agree on having a consistent style I can create a JIRA and take
>>a stab at changing the classes
>>to use the same indention. Also, in that case what should be the
>>standard, 2 or 4 spaces?
>>
>>Thanks,
>>Arup
>

Reply via email to