/Community

A Support Community for SubMain Products
in Search
Welcome to SubMain Community Sign in | Join | Help

Rule to remove underscore

Last post 06-22-2008, 11:12 AM by Serge B.. 2 replies.
Sort Posts: Previous Next
  •  06-21-2008, 2:10 AM 552

    Rule to remove underscore

    Hi,

    I have created custom rule to check private field if use "_" as prefix and warn. It works fine. However, how could I specify its action to remove "_"?

     I tried to create a new rule which based use replace identifier prefix rule, specified "_" to prefixtocheck and leave empty to prefixtoreplace. However, it is not supported. Then I tried to specify "m_" to prefixtoreplace. Unfortunately, it failed to detect any violation. Instead, it complaint my eventargs e contain "_" but it actually not.

    Please advice.

     Thank you
     

  •  06-21-2008, 10:37 PM 558 in reply to 552

    Re: Rule to remove underscore

    We may be a bug. We will try to reproduce it on Monday and get back to you.

    Thank you for your patience.

     


    Thank you,
    Serge Baranovsky
    http://submain.com - .NET Developer Tools  |  Microsoft VB MVP  |  http://vbcity.com - VB Developer Community
    » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right
    » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
  •  06-22-2008, 11:12 AM 565 in reply to 558

    Re: Rule to remove underscore

    We tried rule "Use or avoid certain prefixes", checked Field as Target and properties:

    PrefixToCheck: '_'
    NextCharCapitalizationStyle: Lower
    PrefixUsage: Avoid

    This doesn't work - there is a glitch that ignores the underscore.

    We will fix the glitch.

    However we found a workaround you can use right now:

    Rule: ReplaceIdentifierPrefix
    PrefixToCheck: '_'
    PrefixToReplace: ' ' (a single space - will be trimmed by CIR to an empty string)

    This should remove the underscores they way you want it.

     


    Thank you,
    Serge Baranovsky
    http://submain.com - .NET Developer Tools  |  Microsoft VB MVP  |  http://vbcity.com - VB Developer Community
    » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right
    » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
View as RSS news feed in XML