Resharper (Find and) fix all issues at once
Solution 1
For now, you have to go through the issues individually. There's an existing request to batch-apply fixes to all similar issues selected in the "Inspection Results" tool window.
Code Cleanup does batch-remove certain issues in any given scope but it's quite limited in the number of fixes it can apply, compared to the number of code issues that ReSharper is able to detect.
Solution 2
Click into a redundant qualifier, alt+enter, then choose from the context menu that lets you fix the issue however thoroughly you'd like.
I'm running ReSharper 8.2.
Solution 3
Yes, you can use ReSharper's "Cleanup Code" to remove redundant qualifiers (amongst other things). This is available from the context-menu when you right-click files, projects and folders in the Solution Explorer window. Code Cleanup will run over all the selected files, reformatting and fixing common issues - it is also customizable.
Solution 4
This is available (in part) in the latest build. If you go to a specific issue in the code editor, click the lightbulb the fix option now has a submenu for some issues that can be applied to the entire solution. Would be cooler if it was available from the Code Issues window, but still a great improvement.
https://www.jetbrains.com/help/resharper/2016.1/Code_Analysis__Fix_in_Scope.html
Cel
Contact: http://www.linkedin.com/pub/kristjan-laane/40/9b0/698
Updated on July 12, 2022Comments
-
Cel almost 2 years
e.g. alt enter -> context menu -> Find all 'Redundant name qualifier' issues -> but now in the new window that lists all those issues in my project, is there a way to fix them all ? (rather than go through them individualy)
ta.
-
tsells over 12 yearsIf you are going to use code correct features such as this I highly recommend that you do a diff on each file changed and confirm the changes. I would NEVER run something like this on production code without a line by line inspection (changes) after running it.
-
Tim Lloyd over 12 years@tsells I've been doing this for years, it's FINE.
-
tsells over 12 yearsI would disagree. Every piece of software has the potential for bugs. What happens when the next release of resharper contains some unknown race condition that your code happened to raise. Now your code will still compile - but depending on what changes to your code were made - you may now have a bug in your code that your clients will suffer for. You should never check in code without knowing EXACTLY what changes were made.
-
Tim Lloyd over 12 years@tsells The question is about automating code cleanup, if you have issues with this, then please comment on the QUESTION, not on my ANSWER.
-
Cornelius over 12 yearsExcept that your answer throws a subtactical cleanup nuke on the code that addresses way more issues than the original "Fix this kind of errors". I agree with tsells that you should not blindly check in all the changes ReSharper believes are The Right Thing without making sure it actually is the right thing.
-
Admin almost 12 yearsit is incredible that this option is not available. Having similar issues in a list, the menu of fix options would be the same, so this is pretty easy to implement.
-
Jura Gorohovsky almost 12 yearsThis is relatively easy to implement in basic cases only (many of which Code Cleanup already covers). When there's a single warning that can be fixed when multiple different quick-fixes, that's when things get interesting.
-
Admin almost 12 yearsyes, I would add that the simplest case is the most usual, so maybe a "limited edition" of that functionality would be a great addition to Resharper. Moreover, this is specially frustrating when you try to review code quality of a non-owned application with 100K+ Lines.
-
Mark over 11 yearsJust adding that "Cleanup Code" can be executed by Ctrl+E, C. Also, in the "Cleanup Code" options for Resharper, you can create a profile of the cleanup methods you want Resharper to perform. That way you're not blindly running all of the preconfigured options, you can figure out what they're doing first.
-
joncodo over 11 yearsIs this still not fixed with resharper 7?
-
Jura Gorohovsky over 11 years@JonathanO Nope, still not implemented.
-
Jeff over 10 yearsI agree with the caution expressed, however I also agree with @TimLloyd that, unless you're using reflection (including serialization; ESPECIALLY BinaryFormatter), you will be fine. I would even go so far as to argue that if your code can't "withstand" a ReSharper cleanup, you're doing something else wrong.
-
thomas nn about 10 years@JonathanO Nope, still not fixed in Resharper 8 :(
-
Dan Is Fiddling By Firelight about 10 yearsR#er 8's new Fix in Scope feature looks like it can do mass fixes for at least some types of issues: blog.jetbrains.com/dotnet/2013/10/14/…
-
Jura Gorohovsky about 10 yearsDan, that's correct, thanks for noting this. We're also developing Fix in Scope further for 9.0. For example, we've already implemented mass naming fixes.
-
stricq about 8 yearsIt's still not available in ReSharper 10!
-
RJB almost 8 yearsReally? 5 years and 4 versions later, we still have to Alt+Enter every single squiggly? Even when it's all listed right there? Can't just select multiple -> alt + enter? Beyond lame.
-
Jura Gorohovsky almost 8 years@RJB You still can't fix issues from the Inspection Results window but there's a lot of inspections that you can batch-fix from the Alt+Enter menu. See John Crowell's answer for an example.
-
Coxy almost 8 yearsIt seems incredible to me that they implemented the whole "Find similar issues" functionality only to have an Inspection Results window that is completely useless. Really, export? Why would I ever want to do that!
-
Jura Gorohovsky almost 8 years@Coxy Believe it or not, there are people who use export to share ReSharper inspection results with non-ReSharper users (we blogged about this in the past: blog.jetbrains.com/dotnet/2012/09/28/…)