[postgis-devel] Code formatting digging in

Darafei "Komяpa" Praliaskouski me at komzpa.net
Sat Mar 3 04:14:13 PST 2018


сб, 3 мар. 2018 г. в 0:05, Sandro Santilli <strk at kbt.io>:

> On Fri, Mar 02, 2018 at 10:49:23AM +0000, Darafei "Komяpa" Praliaskouski
> wrote:
>
> > I volunteer to commit to maintain consistent PostGIS codebase formatting
> as
> > responsibility in project.
> >
> > That would save everyone the hassle of thinking about styling, finding
> > exact version numbers of software they don't care about, and get no
> > frustration of broken CI because of code white space and not logic.
>
> How do you plan to do that ?
> I'd like to avoid a change history like:
>
>  ...
>
> Avoiding that would imply a pre-commit processing.
>

We don't really need to format every commit, people "blend into"
surrounding code most of time nowadays. I see it this way:

r2000 Format
r2001 Add feature
r2002 Add feature
r2003 Fix bug
...
r2055 Format per request of <username>
r2056 Bugfix by <username>
....
r2156 Format
r2157 Release 2.5.N+1 tag.


> > The main reason I formatted lwgeom_geos.c file completely was it having
> > unmatched indentation levels that are hard to find manually.
>
> Theoretically those should be taken care of by editorconfig, does
> your editor support it ? Does it change all lines on exit or just
> the ones you tweak ?


Sandro, it's not how editorconfig works. What it does is setting editor's
tab stops width and type of characters to generate on pressing tab on the
start of the line.
Think of it as of a replacement for vim's ModeLines, that used to be /*
vim: set ts=8 sw=4 tw=0 noet : */.

It's going to auto-set the cursor to right spot for the newly written code
after typing {<enter>, but not perform a reflow and fix a mismatch in
indentation (error in level, not type) of old code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20180303/e53516f2/attachment.html>


More information about the postgis-devel mailing list