icnocop / cuite

Coded UI Test enhanced Framework
Microsoft Public License
52 stars 29 forks source link

Update ReSharper settings information #91

Closed FantasticFiasco closed 8 years ago

FantasticFiasco commented 8 years ago

I've added information on how to edit and save ReSharper settings. I am using ReSharper 2016.1.1 but guess the steps are the same for older versions.

Regarding the issue you had with using statements being added within the namespace and not at the top of the file, I assume that is due to the ReSharper setting add 'using' directive to the deepest scope in the C# Code Style section of the ReSharper configuration. You can read more about it on JetBrains webpage.

Since the team-shared configuration doesn't state that imported namespaces should be added to the deepest scope, I assume that you have a personal ReSharper settings file that overrides the team-shared. That would be a file named CUITe.sln.DotSettings.user. If existing, try to remove that file and see what happens.

FantasticFiasco commented 8 years ago

@icnocop Did the previous description solve your problem?

FantasticFiasco commented 8 years ago

Your name seems to pop up everywhere, I just saw it on Docker Toolbox.

Have you had time to look at the PR?

icnocop commented 8 years ago

Thank you for the pull request and your patience.

I will take a look in the next couple days, if not today.

I've updated my version of ReSharper to 2016 yesterday so I can test.

:)

icnocop commented 8 years ago

I opened CUITe.sln in Visual Studio 2013, went to ReSharper > Manage Options... > Solution "CUITe" team-shared > Add Layer > Open Settings File... > CUITe.sln.DotSettings:

cuite resharper 2

I then went into SearchConfigurator.cs and moved "using System;" to a deeper scope:

cuite resharper 1

But still no inspection warning; no light bulb on the left column, or warning symbol on the top right corner.

Solution "CUITe" personal Options: cuite resharper 3 personal

Solution "CUITe" team-shared Options: cuite resharper 4 team shared

This computer Options: cuite resharper 5 this computer

ReSharper Code Inspection Settings: cuite resharper 6 code inspection settings

ReSharper C# Code Style: cuite resharper 6 c code style

FantasticFiasco commented 8 years ago

Clarification: ReSharper will not warn you when the using statements are inside the namespace (there doesn't seem to exist such a rule), but having add 'using' directive to the deepest scope unchecked, as you do in all layers of your settings, should prevent ReSharper to add them there if a using statement is missing and you use the ReSharper light bulb to fix the problem.

You can try that by removing using System; and let ReSharper fix the problem, both when add 'using' directive to the deepest scope is checked and unchecked.

To summarize, with the current configuration ReSharper will add missing using statements before the namespace is declared which is the behavior we want (I guess), but there is no way to configure ReSharper to warn if the using statement is within the namespace. I am sorry if I let you believe otherwise.

If everything else is to your satisfaction, tell me so and I'll merge the PR.

icnocop commented 8 years ago

Can we get StyleCop to provide a warning or error message about this non-conforming coding style?

FantasticFiasco commented 8 years ago

No I don't think so. We can give StyleCop a try if you wan't, my guess is that it supports this kind of configuration.

icnocop commented 8 years ago

StyleCop has rule SA1200 which we can use to enforce consistency within our code.

FantasticFiasco commented 8 years ago

Sorry, I misread your comment from May 24. I thought you where referring to ReSharper when I said I didn't think so. Yes, StyleCop can find these syntax problems. I have some experience with StyleCop Analyzers and we can incorporate that in CUITe. But I would like to do that in a separate PR if possible. Is that ok for you?

icnocop commented 8 years ago

Yes, I think StyleCop Analyzers is the way to go, and it can be in a separate PR. I think this PR can be merged if it still applies. StyleCop Analyzers requires Visual Studio 2015, so we should also upgrade the CUITe.sln file to open in Visual Studio 2015 by default. Thank you! :)