Leszek Ciesielski | 18 Aug 12:25
Gravatar

C# automatic code formatter

Hi,

almost every week there is a patch submitted to this list that gets
rejected/postponed because of formatting issues. Java has many very
good tools like this, e.g. Eclipse built-in.

Isn't there a tool for automatic formatting of C# code according to
some guidelines (in this case,
http://www.mono-project.com/Coding_Guidelines )?

Regards,

Leszek 'skolima' Ciesielski
M. David Peterson | 18 Aug 12:47

Re: C# automatic code formatter

On Mon, Aug 18, 2008 at 4:28 AM, Leszek Ciesielski <skolima <at> gmail.com> wrote:
Hi,

almost every week there is a patch submitted to this list that gets
rejected/postponed because of formatting issues. Java has many very
good tools like this, e.g. Eclipse built-in.

.NET has VS.NET, Sharp Develop, and MonoDevelop from a tooling perspective.
 
Isn't there a tool for automatic formatting of C# code according to
some guidelines (in this case,
http://www.mono-project.com/Coding_Guidelines )?

NAnt has a task for converting tabs into spaces and vice versa.  It seems to me that if an enhancement to this task doesn't already exist that formats the source code based on a defined set of guidelines it shouldn't be too difficult to create.  It might even be as easy as scripting up a MonoDevelop macro of some sort.

To make things all that much better, writing an SVN hook that auto formats each check-in might be an interesting approach.  It would certainly produce cleaner diffs for review if each file was formatted using a pre-commit hook.

--
/M:D

M. David Peterson
Co-Founder & Chief Architect, 3rd&Urban, LLC
Email: m.david <at> 3rdandUrban.com | m.david <at> amp.fm
Mobile: (206) 999-0588
http://3rdandUrban.com | http://amp.fm | http://www.oreillynet.com/pub/au/2354 | http://news.oreilly.com/m-david-peterson/
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Igor Guerrero | 19 Aug 16:26
Favicon
Gravatar

Re: C# automatic code formatter

On Mon, Aug 18, 2008 at 6:28 AM, Leszek Ciesielski <skolima <at> gmail.com> wrote:
Isn't there a tool for automatic formatting of C# code according to
some guidelines (in this case,
http://www.mono-project.com/Coding_Guidelines )?

VIM, just open the file in VIM and type: gg=G and that's it, first you have to configure VIM for Mono's coding guidelines.

--
http://igordevlog.blogspot.com
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
Leszek Ciesielski | 19 Aug 16:53
Gravatar

Re: C# automatic code formatter

On Tue, Aug 19, 2008 at 4:26 PM, Igor Guerrero <igor <at> ubuntu.org.ni> wrote:
> On Mon, Aug 18, 2008 at 6:28 AM, Leszek Ciesielski <skolima <at> gmail.com>
> wrote:
>>
>> Isn't there a tool for automatic formatting of C# code according to
>> some guidelines (in this case,
>> http://www.mono-project.com/Coding_Guidelines )?
>
> VIM, just open the file in VIM and type: gg=G and that's it, first you have
> to configure VIM for Mono's coding guidelines.
>

Now this would be great. Could anyone share such a configuration file?
Igor Guerrero | 20 Aug 04:53
Favicon
Gravatar

Re: C# automatic code formatter

On Tue, Aug 19, 2008 at 10:53 AM, Leszek Ciesielski <skolima <at> gmail.com> wrote:
> VIM, just open the file in VIM and type: gg=G and that's it, first you have
> to configure VIM for Mono's coding guidelines.
>

Now this would be great. Could anyone share such a configuration file?

I'm sorry I meant that's it for the indentation only.

This is what I have in my ~/.vimrc:

set ai ts=4 sts=4 sw=4 si nu

--
http://igordevlog.blogspot.com
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list <at> lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Gmane