What kind of custom rules do you want to write?


Our excellent program manager, Joe Rohde, is trying to gather information on the kinds of custom rules customers want to write.



I am a program manager for our Code Analysis system. I want to know what kind of custom rules you would like to write. Ignore what you may or may not know about what’s in FxCop already. If you could track anything – tell me what you want!


I don’t care if it’s things you know we can’t do – except maybe ‘find my bugs’. Tell your friends, tell anyone who has ever said: I wish this thing could…


The reason I want everything is both to help plan the rules we should just plain provide; and how to best provide an actual supported extensibility feature.


Please send what you would like to see to: JRohde@Microsoft.com


Thanks!


Joe


Provide Joe with feedback and help us plan our future extensibility.

Comments (8)

  1. Peter Ritchie says:

    Cool, thanks for the reference David…

  2. name says:

    Does Joe have a blog? I prefer to avoid e-mail unless absolutely necessary. Or should I leave comments here?

  3. davkean says:

    Joe doesn’t have a blog. However, feel free to leave feedback on this post.

  4. chronos says:

    I have a custom rule that flags ever usage of DateTime as a possible (and very likely) bug. This is because in the default instance, DateTime is fundamentally broken. The fix is to manually set to UTC every single time. See the BCL blog for several related posts and especially comments. I would prefer to adjust this rule to flag only those DateTime usages that are not set to UTC.

    It is with extreme regret and sadness that after all these years Microsoft will not provide an IDateTime interface to finally fix this problem, and the type can not be extended. There are a few hacks which change the details for Orcas, but none of them are solutions and the real problem still remains.

  5. Matthew H says:

    I would like to see a rule that highlights when an exception of type Exception is caught _but_ then not re-thrown.  We often catch exceptions in the business tier to add some context to the message and then throw a new exception with the original as the InnerException value so we can more easily track down the source of the problem.

    Thanks for asking!

  6. Jeff Boyd says:

    Here are static code analysis rules I’ve written:

          AssertValid checking to add. Code is generated to create AssertValid functions and test each pointer data member.

          Boolean members to add to class ‘Bool’. This lets meaningful names be used as parameters, instead of ‘true’ and ‘false’.

          Class members not in a section.

          Class members without a name.

          Code to move to a section.

          Files to rename to match the class name.

          Files with the same name, in different directories.

          Function-body code-blocks to add.

          Function-parameters with unknown words.

          Functions with an undocumented return value.

          Functions with multiple return statements.

          Functions without definitions.

          Globals to move to a class.

          Large ‘.obj’ files.

          Local variables with unknown words.

          Multiple variables declared in the same statement.

          Names that appear in both the ‘known’ and ‘misspelled’ word lists.

          New and misspelled words found in comments and identifiers.

          Sections that are nested.

          Sections to merge.

          Sections to move, to be alphabetically sorted.

          System-class function-calls to update to library-class function-calls.

          Tokens to update to macros.

          Undocumented classes.

          Undocumented data.

          Undocumented functions.

          And more.

      The Reports check:

          Class hierarchy organization.

          Constructor error checking.

          Constructor initializer lists.

          Destructor error checking.

          That related code is in the same section.

      The Reports help:

          Create a classes organizational tree, which is displayed by the browser.

          Sort lint messages and remove duplicate messages, to make linting faster.

          Rename class-member data names to start with ‘m_’.

          Rename class-member names to contain known words.

          Rename class-member names to end with their type.

          Rename classes.

          Rename function local variables.

          Rename function return-values to start with ‘result_’.

          Rename function-parameters.

          Rename functions.

      The Reports:

           AssertValid checking.messages

           AssertValid.messages

           autoexp

           char.messages

           Check_constructor_error_checking.messages

           Check_constructor_initializer_lists.messages

           Check_that_related_code_is_in_the_same_section.messages

           Class Bool.messages

           Class hierarchy.messages

           Class members not in a section.messages

           Class members without a name.messages

           Class-member names used in more than one section.messages

           Classes organizational tree.messages

           Code to move to a section.messages

           File to rename to match the class name.messages

           Files with the same name.messages

           Function-body code-blocks to add.messages

           Function-parameters with unknown words.messages

           Functions with an undocumented return value.messages

           Functions with multiple return statements.messages

           Functions without definitions.messages

           Globals.messages

           Large obj files.messages

           Lint

           Local variables with unknown words.messages

           Move_code.messages

           Multiple variables declared in the same statement.messages

           Names that appear in both the ‘known’ and ‘misspelled’ word lists

           new and misspelled words found in  comments.messages

           new and misspelled words found in library module # comments.messages

           new and misspelled words.messages

           Rename class-member data names to start with ‘m_’ – These names are used more than once.messages

           Rename class-member data names to start with ‘m_’.messages.messages

           Rename class-member names – These names are used more than once.messages

           Rename class-member names to end with their type – These names are used more than once.messages

           Rename class-member names to end with their type.messages

           Rename class-member names.messages

           Rename function local variables.unsorted.messages

           Rename function return-value to start with ‘result_’.messages

           Rename function-parameters.sorted.messages

           Rename Function-parameters.unsorted.messages

           Sections that are nested.messages

           Sections to merge.messages

           Sections to move, to be alphabetically sorted.messages

           spell_checking_Enabled

           System #include statements that do not use angle brackets.messages

           System objects to update to library objects.messages

           system-class function-calls.messages

           tokens_to_update_to_macros.messages

           Undocumented classes.messages

           Undocumented data.messages

           Undocumented functions.messages

           usertype

  7. John says:

    Checking that option explicit and strict are switched on.  VB specific I know, but absolutely essential in my opinion.

  8. John says:

    Checking that option explicit and strict are switched on.  VB specific I know, but absolutely essential in my opinion.