← Back to team overview

kicad-developers team mailing list archive

Re: clang-format seems to be breaking the rules?

 

Brian,

On 3/20/2019 12:46 PM, Brian wrote:
> I'm trying to get better at not breaking the KiCad style guidelines, but
> then I see the clang-format tool make suggestions like this:
> 
> - static LIB_TEXT* loadText( std::unique_ptr< LIB_PART >& aPart,
> LINE_READER& aReader,
> - int aMajorVersion, int aMinorVersion );
> - static LIB_RECTANGLE* loadRectangle( std::unique_ptr< LIB_PART >& aPart,
> - LINE_READER& aReader );
> + static LIB_TEXT* loadText( std::unique_ptr<LIB_PART>& aPart,
> LINE_READER& aReader,
> + int aMajorVersion, int aMinorVersion );
> + static LIB_RECTANGLE* loadRectangle( std::unique_ptr<LIB_PART>& aPart,
> LINE_READER& aReader );
> 
> This doesn't seem right to me, in particular pulling the second line of
> the loadText definition leftward and removing the spaces around template
> parameters.  It makes me reluctant to blindly do a `git clang-format`
> before a commit.
> 
> Comments / advice?

This is why I didn't allow this to be always hooked when making commits.
 I don't trust them to do exactly what I want.  Technically we do not
define this indentation.  It can be either indented one level (4 spaces)
or aligned with the first parameter.  I prefer the latter.  In either
case, this indentation doesn't appear to be correct.  I don't pretend to
be a clang-format expert but I'm guessing this can be fixed with the
appropriate setting.  Your best bet is to configure your editor to
perform the code formatting to match the kicad coding policy.

Cheers,

Wayne

> 
> Thanks,
> -Brian
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Follow ups

References