views:

124

answers:

6

Always, I have got the following message:

name 'byteProivder_LengthChanged' does not match 'Methods, properities and events'. Suggested name is 'ByteProviderLengthChanged'

Not even the VS generated method name could get away from this suggestion. For example FormXXX_Load is adviced to change to FormXXXLoad.

So what should I do? Should I follow the name suggestion or just keep the VS style? If I follow the name suggestion, how to configure the resharper and let it change the name automatically? If I do not follow the reshaper way, how could I turn this name suggestion option off?

A: 

Resharper is trying to make you adhere to Microsoft's own naming guidelines which is a good idea, especially if your team is not using any naming conventions already. Using a naming convention gives your code greater readability and a more consistent API.

klausbyskov
A naming convention is one thing; an explicit convention is another; and machine-verification of a convention that probably doesn't match your project's reality is again different.
Eamon Nerbonne
In my opinion you define your own project's reality.
klausbyskov
+2  A: 

I do not follow all r# suggestions. The one i don't like i change, the one that can't be changed i turn it off. (we have our own guidelines)

gsharp
+2  A: 

Personally I suppress those warnings and then it ignores them

if you go to ReSharper > then choose Inspection Severity in the Code Inspection menu then you can switch this off

PaulStack
This is the best option - the naming guidelines are meaninglessly and annoyingly limiting. Such guidelines are fine suggestions, but not worth the harassment when you choose to deviate from them (presumably, ironically, for readability reasons).
Eamon Nerbonne
A: 

You can also use StyleCop for ReSharper and define your own rules or modify default behaviour to follow your style

Nick Martyshchenko
+1  A: 

Resharper's advices are (in most cases) useful, but sometime they miss the target, and can even be a bit annoying.

You have three solutions for this: 1) Edit the resharper's definitions to match your liking (this is possible by selecting "edit X rule settings" from the quickfix menu on the left)

2) Hide the annoying resharper message (either localy with a comment or globaly by changing ths settings for this type of setting. Both are possible from the quickfix menu)

3) Ignore the resharper's message when it's simple useless.

No matter what you choose, make sure your selection encapsulates your entire work (as well as your teams work, if your a part of one). For instance, in the case of option 3, make a list situations where the resharper is ignored.

Keeping your code cosistant is vital to any project (be it small or large), and should be your first guideline when think about the resharper.

Hope this helps

Neowizard
I disagree. Names are intended to represent something meaningfull and cannot practically be condensed into (accurate) global guidelines. For instance, when VS appends _Load, it does so consistently, and thus *recognizably* and *readably* - whether or not that happens to be in any explicit guideline. Simiarly, any reasonable large project *should* have various readability-enhancing conventions - which, being project-dependant, almost certainly won't fit into a useful global guideline.
Eamon Nerbonne
Lest it be forgotten; machine-verification of such naming guidelines comes at a cost. These warnings distract from real issues in your code and cost time and attention to resolve. It's a good idea to occasionally improve names to clarify code, but it's a bad idea to *by default* obfuscate code with warnings and squigglies to achieve that.
Eamon Nerbonne
@Eamon, a global guide line would always be limited to a given project, so the goal is not to fit all projects into one convention (if this was the case, you'd see many standards regarding the issue). Furthermore, names are intended to represent something meaningfull, as you said, but naming conventions are not about the name, but about the way you present it, so ,again, I don't argue that a global guide line should cover this part.
Neowizard
@Eamon, regarding your second note, +1
Neowizard
Yeah, I'm exaggerating a little; indeed :-) I'm certainly not opposed to consistent naming - just resharpers default means of achieving that consistency.
Eamon Nerbonne
A: 

If you want to turn off some code inspections, i think, the easiest way is to choice "Inspections options for...." from the menu that shows on the right side in editor (for that particular error/warning). Then a popup will show up and you can change the behavior of that type of inspections. Last option:"Do not show" does the trick.

This applies to R# 5.0 and probably 4x as well.

In general, you should use the coding standards that you think will fit your needs.

klm_