Is there a way to make ReSharper check for correct file headers - resharper

Update: Using StyleCop for ReSharper Plugin did the trick for code analysis inside VS. But unfortunately it seems that ReSharper plugins don't work in ReSharper command line inspections.
Is there a way to make ReSharper check for correct file headers just like classic StyleCop did. I'm aware that there is a way to define file headers to be inserted in new files, but we are using Resharper command line inspections to check a rather big legacy codebase. So it would be helpful if there was an automatic check for correct file headers.
I'm referring to StyleCop rules SA1633 up to SA1649.

This isn't exacly an answer to your question but you can use editorconfig to increase the error level during build.
Refer to roslyn editorconfig

Related

ReSharper with StyleCop Configuration

My understanding is that running StyleCop as a ReSharper extension uses the Analyzer technology built into VS 2015 and, in this way, it differs from downloading and installing StyleCop as a standalone program. When I previously installed StyleCop as a standalone program, I had access to a StyleCop .Settings file that let me use the StyleCop dialog box for selecting certain options. Among those options was a Company Information tab, into which you can place Company Name and a Copyright notice:
StyleCop Settings Documentation for the Company Information Tab
When ReSharper shows a StyleCop rule that needs attention and it has to do with adding a XML summary comment to the top of my class, ReSharper places the comment text for me. However, there is a space for Company Name and that value is always blank. This means that I must modify it manually, and that's tedious.
Question:
How do I tell ReSharper to populate the Company Name field with a certain value? Can I do that on a solution basis or does that Company Name field get defined globally?
Thank you.
If you're using StyleCop for ReSharper, it's actually using the same StyleCop parser that the command line uses, and not the VS2015 analyzers (unless you're actually using StyleCopAnalyzers). However, inserting comments and rewriting code is all ReSharper code. The plugin will still use your existing stylecop.settings files, and the company name comes from there. You can edit the file with the settings editor from the normal install of StyleCop.

What is the general approach to fixing Go To functionality in Resharper

I often see that some of the ReSharper functionality just doesn't work until you restart VS and reopen the project. But this situation I have now is consistent across restarts. So I am using a Go To Everything fuctionality often. It is enabled in ReSharper settings.
But since yesterday Go To Everything (Ctrl + N for me) can't find most of the files in the project (though it can find some).
Here is a screenshot of the problem:
I have that file open in editor just to prove that it's there. I show it found in an open solution in file tree. But ReSharper doesn't seem to be able to find it.
What to I do to troubleshoot. Thanks you in advance.
The best thing to do here is to raise an issue with JetBrains. Either log a bug with the issue tracker, or email resharper-support#jetbrains.com. Include details about what version of ReSharper you're using, what type of projects you're using, version of Visual Studio, etc.
However, from that screenshot, it looks like ReSharper isn't configured to analyse that file - there's no "green tick" in the scrollbar. Is ReSharper disabled? Is that file excluded from analysis? (Mind you, even when it's excluded, it should still show up in go to results. Something odd is happening here, support should be able to help better than StackOverflow)

Visual studio - set file location

I have a VS project, but I moved some source, resource files to another location.
It's not easy for me to readd all again (cause of filled properties tab for custom build tools, etc.)
Is there any easy GUI way to change the included source file path? In XCode it's easy to do this, but I don't see any way in Visual Studio (currently using 2012).
Do I have to rewrite the xml build file?
I have finally find it. Easiest way is to edit the xml file .vcxproj. I just have to manually find the paths (they are relative... i dont really know why Microsoft did this, it is so stupid) in that xml and edit it.

resharper disable for c# .cs files

is it possible to only enable resharper for javascript and css files? I don't want it inspecting my c# files as it's driving me nuts with it's styling and and at times somewhat controversial recommendations. I haven't got time to set each individual setting, I'm just looking for a "don't inspect c# files" check box, if there isn't one I think my resharper trial will be officially over.
If you really want to disable ReSharper for C#, try going to ReSharper | Options -> Code Inspection | Settings -> Edit Items to Skip and add a file mask to skip *.cs.
But better way would be to disable those ReSharper warnings that you don't like. To do this, click Alt-Enter on the suggestion that you don't like, go to Options submenu, select Configure inspection severity and then Do not show. This is for ReSharper 8.0, in 7.1 it should be pretty similar.

Sort "usings" directive by ReSharper Clean-up

How to setup ReSharper to call "Sort usings" in class?
I will answer for my question.
Using shortcut from Resharper it's not best solution. Nice tool is CodeMaid it makes few nice cleanup's when saving file like with no shortcut key press:
sorting usings alphabetically and remove unused
deleting empty lines
This tool is complement for Resharper.
Resharper (9) will sort usings if you run Code Cleanup, via menus or keyboard shortcut CTRL+E, CTRL+C
Try using the Stylecop Resharper Plugin
Stylecop Rule SA1210: Using directives must be sorted alphabetically by the namespaces will allow you to use a quick fix to sort them by pressing ALT+ENTER.
Using Stylecop is good at helping you write clean code, but you may want to turn off some of the rules.
You don't need ReSharper to do this. By Default the shortcut CTRL+E, R will remove (unused) and sort the using statements.
If you only want sorting or the shortcut isn't set on your instance of Visual Studio, go to:
Tools-> Options.
Environment -> Keyboard
Search for "Editor.ContextMenus.CodeWindow.OrganizeUsings".
There are a few options there to play with.
This question already covers this:
Remove unused Usings across entire assembly
The feature is in ReSharper 4.5. If you right click on the solution,
there's a Cleanup Code... item, which allows you to apply a cleanup
profile to the solution. You can create a new cleanup profile from the
Code Cleanup node within ReSharper options, if you want a profile to
just adjust the using directives.

Resources