Sourcecode styling

General disucssion on Regionerate.

Sourcecode styling

Postby barryd » Wed Dec 03, 2008 6:57 pm

Hi,

A while ago I found your tool. Most of it works really great. But during the testing period I noticed a few styling issues that I cannot resolve within a custom layout file or a quick change in the source code.

Our development team is using Stylecop (http://code.msdn.microsoft.com/sourceanalysis) to enforce a uniform styling of the code. One of the rules enforces the usage of spaces instead of tabs to indent the code.This option is not configurable in a custom layout, but looking at the soucecode it is quite easy to add this functionality. For testing purposes I have already added a hardcoded replace to the GetTabString(int tabAmount), but getting it in a configuration options will result in changing more code files which will make it a lot harder to stay up to date with bugfixes. It would be nice to see a configuration option to set a number of spaces which can be used to replace the default tabs in the official releases.

The other styling issues which I noticed that could not be resolved with a custom layout file are the following:

Nested Classes:
When a class contains one or more nested classes, the separating lines are not added in an expected way.
- After the region name there are 2 separating lines instead of the expected 1.
- At the end of the region there is no separating line between the end of the nested class and the endregion tag.

Nested structs:
- It is not possible to recognize nested structs and put them in the same region as nested classes.
- When using nested structs the separating lines between the structs (and between the struct and a custom region) are removed.
- The number of separating lines between rgionated regions and custom regions or unrecognized code contains to many lines.

Enums:
- In the regionate settings file a region is defined for enumerations, After each region the indentation whitespace is removed for the next statement, which (in our case) contains the "<summary>" tag in the comment lines.

As an attachment I have included the layout file used, some classes to reproduce the styling issues and a copy of the stylecop settings we are using.

Is there a way to fix these issues?

Thanks in advance,
Barry
Attachments
reproduce.zip
(3.5 KiB) Downloaded 90 times
barryd
 
Posts: 4
Joined: Thu Oct 02, 2008 2:25 pm

Re: Sourcecode styling

Postby rauchy » Wed Dec 03, 2008 8:00 pm

Barry,

Thank you for your comments.

Support for spacing instead of tabs sounds like a great feature and I'm sure lots of users will enjoy it. The best thing about open source software is that your can have most features implemented pretty quick if you just sit down for a couple of hours and code them yourself.
I am currently swamped with college stuff, and before sitting down on this feature, I have a dozen others waiting, so I really think the fastest way to see this happening is by contribution.

Regarding the other issues - all these sound like bugs and it would be nice if you could open tickets for them.

Thanks.
-- rauchy.
rauchy
Site Admin
 
Posts: 267
Joined: Wed May 09, 2007 2:39 am
Location: Israel

Re: Sourcecode styling

Postby barryd » Mon Dec 08, 2008 10:55 am

The tickets are created.
http://trac2.assembla.com/Regionerate/ticket/48
http://trac2.assembla.com/Regionerate/ticket/49
http://trac2.assembla.com/Regionerate/ticket/50

For the support for spaces instead of tabs, I will make the modifications when I get the time for it, and add it as contribution.
barryd
 
Posts: 4
Joined: Thu Oct 02, 2008 2:25 pm

Re: Sourcecode styling

Postby barryd » Wed Dec 10, 2008 5:44 pm

In the tracker there was already an enhancement request for indenting with spaces instead of tabs. (actually it is there twice, ticket 32 could be deleted)

The patch file to implement the indenting with spaces instead of tabs is attached to this message and to ticket 33 ( http://trac2.assembla.com/Regionerate/ticket/33 ).
Attachments
IndentWithSpaces.zip
(3.96 KiB) Downloaded 91 times
barryd
 
Posts: 4
Joined: Thu Oct 02, 2008 2:25 pm

Re: Sourcecode styling

Postby rauchy » Fri Mar 13, 2009 6:24 pm

Took a while, but its fixed in the trunk. (your contribution, I mean)
It will be available on the next release, but you can get it now by downloading the latest nightly build.

Thanks for the contribution, Barry!
-- rauchy
-- rauchy.
rauchy
Site Admin
 
Posts: 267
Joined: Wed May 09, 2007 2:39 am
Location: Israel


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron