OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

EditorConfig file?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
AnyOldName3 (Chris Djali)
User


Joined: 08 Sep 2017
Posts: 46

PostPosted: Thu Mar 14, 2019 12:02 am    Post subject:
EditorConfig file?
Reply with quote

Hi,

I just noticed (when looking at a local modification and realising my IDE had added tabs to a file using spaces) that the OSG repo doesn't contain an EditorConfig file. This is basically a file that instructs IDEs and editors of a project's whitespace style, overriding the user's settings when they don't match, reducing the chances that someone accidentally messes things up.

I reckon it would be a pretty good idea for OSG to include one. A few other projects I've worked on have done so, and it's been a great help not having to change my indentation settings when changing from project to project.

To be clear, I'm not suggesting something only supported by a couple of editors - it's pretty widely adopted, with many tools coming with native support, and yet more with a plugin available. The list is available here: https://editorconfig.org/

Cheers,
Chris
Back to top
View user's profile Send private message
kornerr
Appreciator


Joined: 01 Oct 2013
Posts: 305

PostPosted: Thu Mar 14, 2019 10:30 am    Post subject:
EditorConfig file?
Reply with quote

Hi.

We're waiting for your pull request ;)

On Thu, 14 Mar 2019 at 03:01, Chris Djali <> wrote:
Quote:

Hi,

I just noticed (when looking at a local modification and realising my IDE had added tabs to a file using spaces) that the OSG repo doesn't contain an EditorConfig file. This is basically a file that instructs IDEs and editors of a project's whitespace style, overriding the user's settings when they don't match, reducing the chances that someone accidentally messes things up.

I reckon it would be a pretty good idea for OSG to include one. A few other projects I've worked on have done so, and it's been a great help not having to change my indentation settings when changing from project to project.

To be clear, I'm not suggesting something only supported by a couple of editors - it's pretty widely adopted, with many tools coming with native support, and yet more with a plugin available. The list is available here: https://editorconfig.org/

Cheers,
Chris

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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
AnyOldName3 (Chris Djali)
User


Joined: 08 Sep 2017
Posts: 46

PostPosted: Thu Mar 14, 2019 1:34 pm    Post subject:
Reply with quote

I'm fine making the pull request. I'd just like confirmation of exactly what the whitespace conventions are - I wouldn't want to set it to use four spaces for indentation for everything and then find out later that the CMake files use tabs or anything like that.

The main rules are listed here: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#current-universal-properties

Beyond knowing if the preferred indentation size and style is the same for all file types (and if not, which differ), I'd like to know if there's any policy for stuff like whether trailing whitespace at the ends of lines should be removed, whether having a blank line at the end of files should be enforced, and whether there's a preferred character encoding (or whether we're going to assume everyone's going to stick to the characters in common between UTF-8 and ASCII).

Cheers,
Chris
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12321

PostPosted: Thu Mar 14, 2019 3:36 pm    Post subject:
EditorConfig file?
Reply with quote

Hi Chris,

The OSG codebase uses four spaces for tabs.

I don't have any strong opinions on adding EditorConfig file.

Cheers,
Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
AnyOldName3 (Chris Djali)
User


Joined: 08 Sep 2017
Posts: 46

PostPosted: Thu Mar 14, 2019 4:35 pm    Post subject:
Reply with quote

I just grepped the repo for tabs just in case, and found that that's not entirely accurate. There are a few files where tabs have snuck into otherwise space-indented files (which is fine - adding an editorconfig file won't meddle with existing stuff until someone edits that line), but it looks like there are a few cases where asking more questions would be a good idea:

  • osgAndroidExampleGLES1 and GLES2 use tabs exclusively for their java, xml and mk files, and I don't know whether that's something we want to override, whether we want specific settings for those projects, or whether we want to prefer tabs globally for java, xml and mk files.
  • There are some files in places like osghangglide, osgviewerFOX and many of the plugins that use either nothing but tabs, or mainly tabs, and it might be more pragmatic to have exceptions made for those files. There's probably some threshold where it makes sense to make a distinction between accidental tabs and intentional tabs, and it might be the whole file uses tabs or it might not, but if so, knowing where it is would be good.
  • There are a lot of tabs in src/osg/glu/libtess/ and I'm assuming that's because it originally came from somewhere else (which I also suspect is the source of the tabs in several of the plugins). If so, excluding it from OSG's indentation rules might be prudent.


Cheers,
Chris
Back to top
View user's profile Send private message
AnyOldName3 (Chris Djali)
User


Joined: 08 Sep 2017
Posts: 46

PostPosted: Mon Apr 01, 2019 9:13 pm    Post subject:
Reply with quote

Hi,

It's been a couple of weeks, and I've not had any response about any official policy on indentation in the case of existing files that already break the global rule. Should I just go for the stance of "it's supposed to be spaces for everything except for files that are already entirely tabs"?

Thank you!

Cheers,
Chris
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12321

PostPosted: Tue Apr 02, 2019 6:56 am    Post subject:
EditorConfig file?
Reply with quote

Hi Chris,

On Mon, 1 Apr 2019 at 22:17, Chris Djali <> wrote:
Quote:
It's been a couple of weeks, and I've not had any response about any official policy on indentation in the case of existing files that already break the global rule. Should I just go for the stance of "it's supposed to be spaces for everything except for files that are already entirely tabs"?

That is probably a reason position to take, but it's a big code base
pulling from various sources, you only start to spot issues when you
start applying features.

Personally I see the OSG as in maintenance, I care about bug fixes and
maintaining the OSG code quality, we've got a long long way into the
life of the OSG without having EditorConfig and we've got on just
fine, it's not something that is ever going to fix a bug, so it's a
low priority for me.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
kornerr
Appreciator


Joined: 01 Oct 2013
Posts: 305

PostPosted: Tue Apr 02, 2019 10:34 am    Post subject:
EditorConfig file?
Reply with quote

Hi, Chris,

just create EditorConfig and share it. Those who are interested will
follow you.Don't wait for us to want your thing. Just do the thing,
show it and explain its benefits.
You're not alone, we're here, but you lead EditorConfig initiative, not us.

Regards

On Tue, 2 Apr 2019 at 09:55, Robert Osfield <> wrote:
Quote:

Hi Chris,

On Mon, 1 Apr 2019 at 22:17, Chris Djali <> wrote:
Quote:
It's been a couple of weeks, and I've not had any response about any official policy on indentation in the case of existing files that already break the global rule. Should I just go for the stance of "it's supposed to be spaces for everything except for files that are already entirely tabs"?

That is probably a reason position to take, but it's a big code base
pulling from various sources, you only start to spot issues when you
start applying features.

Personally I see the OSG as in maintenance, I care about bug fixes and
maintaining the OSG code quality, we've got a long long way into the
life of the OSG without having EditorConfig and we've got on just
fine, it's not something that is ever going to fix a bug, so it's a
low priority for me.

Robert.



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
AnyOldName3 (Chris Djali)
User


Joined: 08 Sep 2017
Posts: 46

PostPosted: Tue Apr 02, 2019 3:27 pm    Post subject:
Re: EditorConfig file?
Reply with quote

kornerr wrote:
Hi, Chris,

just create EditorConfig and share it. Those who are interested will
follow you.Don't wait for us to want your thing. Just do the thing,
show it and explain its benefits.
You're not alone, we're here, but you lead EditorConfig initiative, not us.

Regards



That's the approach I've taken with other projects, but they've tended to follow their own whitespace rules. As an EditorConfig file is a formalisation of whitespace rules, it makes sense to know I'm enforcing the rules the project wants rather than some random ones which I guessed.
Back to top
View user's profile Send private message
AnyOldName3 (Chris Djali)
User


Joined: 08 Sep 2017
Posts: 46

PostPosted: Fri Apr 12, 2019 6:18 pm    Post subject:
Reply with quote

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.

Quote:
.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
Back to top
View user's profile Send private message
kornerr
Appreciator


Joined: 01 Oct 2013
Posts: 305

PostPosted: Sun Apr 14, 2019 2:51 pm    Post subject:
EditorConfig file?
Reply with quote

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:
Quote:

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.


Quote:
.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








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12321

PostPosted: Sun Apr 14, 2019 3:54 pm    Post subject:
EditorConfig file?
Reply with quote

Hi Chris, Michael et. al,

On Sun, 14 Apr 2019 at 15:50, michael kapelko <> wrote:
Quote:
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.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
AnyOldName3 (Chris Djali)
User


Joined: 08 Sep 2017
Posts: 46

PostPosted: Mon Apr 15, 2019 2:14 pm    Post subject:
Re: EditorConfig file?
Reply with quote

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:
Quote:

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.


Quote:
.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








------------------
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:
Quote:
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.


------------------
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.
Back to top
View user's profile Send private message
Michael Weiblen
Guest





PostPosted: Mon Apr 15, 2019 8:52 pm    Post subject:
EditorConfig file?
Reply with quote

FWIW, clang-formating is a requirement before creating pull requests for the Vulkan repos at https://github.com/KhronosGroup -- mew



 




On Sun, Apr 14, 2019 at 9:52 AM Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Chris, Michael et. al,

On Sun, 14 Apr 2019 at 15:50, michael kapelko < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
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
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
Mike Weiblen -- Black Hawk, Colorado USA -- http://mew.cx/

------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert .earth file to .osg format stevenj279 General 29 Mon Apr 22, 2019 5:05 am View latest post
No new posts Change color of node read from dxf file dhhabyc General 10 Sat Nov 17, 2018 12:58 pm View latest post
No new posts How to actually play animation in osg... Warren93 General 3 Tue Oct 23, 2018 1:23 pm View latest post
No new posts Load an obj file and mapping a given ... aaa3d General 3 Mon Aug 06, 2018 2:27 pm View latest post
No new posts osgconv osgjs bug file not found memory_thrasher Plugins [osgPlugins] 2 Tue Jul 31, 2018 5:21 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP