[osg-users] EditorConfig file?

Chris Djali krizdjali at gmail.com
Mon Apr 15 07:14:56 PDT 2019


Hi all,


kornerr wrote:
> Hi, Chris.
> 
> I would guess it might be not exactly appropriate to update
> OpenSceneGraph sources just to have the order in spaces and tabs.
> However, I think VulkanSceneGraph would definitely benefit
> EditorConfig rules. So once VSG has its place at GitHub, I would
> recommend re-raising this issue and creating a pull request.
> 
> Regards,
> Michael.
> 
> On Fri, 12 Apr 2019 at 21:27, Chris Djali <> wrote:
> 
> > 
> > Hi,
> > 
> > Here's a list by file extension of which indentation styles are used. Annoyingly, a lot of the file extensions that always have tabs somewhere often have spaces, too, so it's not quite as simple as declaring all .java files use tabs (although I'm assuming they all used tabs when they were added and then were edited later to have tabs in places).
> > 
> > I'm going to use my best judgement based on how things look and what directory they're in etc. but I'm just posting this to illustrate that it's become a mess and that's why I've not just jumped in with a pull request. Hopefully, when it's done for OSG, it'll be convincing enough that VulkanSceneGraph has a .editorconfig file from early on in the project, and whitespace problems will never come up.
> > 
> > 
> > 
> > > .1: unindented
> > > .README: unindented
> > > .bat: unindented
> > > .c: mixed, spacey, tabby
> > > .cfg: spacey
> > > .cmake: mixed, spacey, unindented
> > > .cpp: mixed, spacey, tabby, unindented
> > > .css: tabby
> > > .h: mixed, spacey, tabby, unindented
> > > .hpp: spacey, unindented
> > > .html: mixed, tabby, unindented
> > > .in: spacey, unindented
> > > .inst: tabby
> > > .java: mixed, tabby
> > > .js: spacey
> > > .l: mixed
> > > .m: mixed, spacey
> > > .md: spacey, unindented
> > > .mk: tabby
> > > .mm: mixed, spacey
> > > .nib: spacey, tabby
> > > .osgt: spacey
> > > .plist: spacey
> > > .properties: unindented
> > > .rc2: unindented
> > > .rc: spacey, unindented
> > > .strings: unindented
> > > .txt: mixed, spacey, unindented
> > > .xml: mixed, spacey, tabby
> > > .y: spacey
> > > .yml: spacey
> > > : mixed, spacey, tabby, unindented
> > > 
> > > 
> > 
> > 
> > Cheers,
> > Chris
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=75831#75831
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > 
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum



An .editorconfig file wouldn't actually edit anything immeditately, but in supported editors, any new changes would have the correct indentation applied (and if someone applied their editor's autoformat tool, that would also apply the correct indentation, just like how if they did that now, it would apply whatever their editor preferences were set to).


robertosfield wrote:
> Hi Chris, Michael et. al,
> 
> On Sun, 14 Apr 2019 at 15:50, michael kapelko <> wrote:
> 
> > I would guess it might be not exactly appropriate to update
> > OpenSceneGraph sources just to have the order in spaces and tabs.
> > However, I think VulkanSceneGraph would definitely benefit
> > EditorConfig rules. So once VSG has its place at GitHub, I would
> > recommend re-raising this issue and creating a pull request.
> > 
> 
> For the VSG I've adopted clang-format to enforce standard formatting,
> I run this periodically to make sure we don't deviate for too long.
> 
> The .clang-format file is:
> https://github.com/vsg-dev/VulkanSceneGraphPrototype/blob/master/.clang-format
> 
> I am not familiar with EditorConfig, for the VSG it won't be critical
> for enforcing format.  I'm open to suggestons but don't want to liter
> the code base with things that aren't critical to the use of the code
> base.
> 
> Robert.
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


It seems that clang-format has a lot of similarities in aim with EditorConfig, with the main difference being that it seems to be a standalone tool that reformats things whereas EditorConfig comes as a library to either integrate into existing editors or create plugins for editors so that mistakes can't be made in the first place.

Helpfully, Visual Studio 2017 (and later) seems to enforce the rules specified in a .clang-format file when one is found as you type, just as it would for an .editorconfig file. However, it doesn't look like any other editors do that, even with plugins, so running it as a separate pass is still necessary. Aside from the decreased chance of messing up git blame, I don't see any reason why VSG would benefit from having both a .clang-format file and an .editorconfig file, so no action is necessary there.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75840#75840







More information about the osg-users mailing list