An open source tool for arranging .NET source code

Forums > Help > Ordering of using alias directives


9/17/2009 7:54:45 AM
Gravatar
Total Posts 2

Ordering of using alias directives

I've just started to use NArrange, and I love it, but I was wondering if it is possible to order the using statements according to the SyleCop rules when it comes to using alias directires.

 

 




9/20/2009 1:00:26 AM
Gravatar
Total Posts 37
James Nies
- NArrange Developer
Astral Softworks

Re: Ordering of using alias directives

Hi there,

Would it be possible to post code samples of the NArrange result and what StyleCop is expecting in this scenario?

Thanks,

James Nies
NArrange Developer




9/21/2009 2:46:00 AM
Gravatar
Total Posts 2

Re: Ordering of using alias directives

Sure thing:

Before NArrange:

namespace Dragon.Library
{
    using System;
    using System.Collections.ObjectModel;

    using LookupDictoinary = System.Collections.Generic.Dictionary<string, string>;

    public static class DDIDecoder
    {
        private static LookupDictoinary compendiumLookups;

        static DDIDecoder()
        {
            DDIDecoder.compendiumLookups = new LookupDictoinary();
        }
    }
}

After NArrange:

namespace Dragon.Library
{
    using System;
    using LookupDictoinary = System.Collections.Generic.Dictionary<string, string>;
    using System.Collections.ObjectModel;

    public static class DDIDecoder
    {
        private static LookupDictoinary compendiumLookups;

        static DDIDecoder()
        {
            DDIDecoder.compendiumLookups = new LookupDictoinary();
        }
}

StyleCop error:

SA1209: Using alias directives must be placed after all using namespace directives.

 Cato




10/11/2009 11:58:01 PM
Gravatar
Total Posts 37
James Nies
- NArrange Developer
Astral Softworks

Re: Ordering of using alias directives

Cato,

Thank you for posting the code sample.  I've filed Bug 2876867 for tracking this issue.




12/5/2009 4:25:08 PM
Gravatar
Total Posts 37
James Nies
- NArrange Developer
Astral Softworks

Re: Ordering of using alias directives

NArrange 0.2.9 has been released.  It changes the sort behavior for alias using directives to conform to StyleCop rules SA1209 and SA1211.





Site Map | Printable View | © 2008 - 2014 NArrange | Powered by mojoPortal | XHTML 1.0 | CSS | Site provided by Astral Softworks, LLC