Another set of 4 great Resharper tips for use with StyleCop!(hockblogs.net)
submitted by
hockman(505) 3 years, 6 months ago
Hi there,
Recently I've blogged about a set of 4 great Resharper tips for use with Stylecop. Here's another great set of 4 Resharper tips for use with Stylecop!
Tip 1: SA1507: The code must not contain multiple blank lines in a row.
By setting the 'Keep max blank lines in code' and the 'Keep max blank lines in declarations' to 1, automatically, when you refactor, the blank lines are set to just one blank line.
Tip 2: SA1024: Invalid spacing around the colon.
You can either fix the spacing around the colon by doing this:
Or doing it so by setting an option, so everytime you'll do a refactor this rule is applied. Just remove the spaces before and after the colon in attribute:
Tip 3: SA1101: The call to [method name] must begin with the 'this.' prefix to indicate that the item is a member of the class.
In my previous post I had this set to 'For fields'. But it is better to set this to 'For this class members' so rule SA1101 is correctly implemented/applied.
Tip 4: SA1000: The spacing around the keyword 'typeof' is invalid.
There should be no spaces before the parentheses.
EXTRA TIP: SA1614: The documentation text within the param tag for the '<param name="exception"></param>' parameter must not be empty.
Actually this has nothing to do with Resharper. But still I would like to make sure that it realy is a must have to have Ghostdoc installed. GhostDoc is a free add-in for Visual Studio that automatically generates XML documentation comments for C#. Either by using existing documentation inherited from base classes or implemented interfaces, or by deducing comments from name and type of e.g. methods, properties or parameters. So Ghostdoc will automatically fills in the param tag by generating comments from parameter names.
Ghostdoc also takes care of SA1600: The field must have a documentation header. and the same rule but then for properties: SA1600: The property must have a documentation header.
Hope this is usefull!
gr,
Robbert
|category: Tips & Tricks
|Views: 98
tags:
Tips another
Everyones tags:
Your Tags: