Stylecopanalyzers: Run autofix across the entire solution

Created on 8 Jun 2016  路  8Comments  路  Source: DotNetAnalyzers/StyleCopAnalyzers

Is there a way I can run autofix across the entire solution, let's say I want the this prefix to be applied to all the files in the solution.

question

Most helpful comment

@darrensteadman In Visual Studio, this is possible for the current document, project, or even entire solution (already from the very first release of VS with analyzers):
image

@sharwell Do you know of any oss tools out there that will run code fixers on an entire solution, as a command line tool?

All 8 comments

Do you mean from a command line, or from within Visual Studio?

I'm interested in this as well, Is it possible to just tell Visual Studio to auto fix an entire file?

@darrensteadman In Visual Studio, this is possible for the current document, project, or even entire solution (already from the very first release of VS with analyzers):
image

@sharwell Do you know of any oss tools out there that will run code fixers on an entire solution, as a command line tool?

@tiesmaster yes, rubocop a linter for linux simply run rubocop -a and it will autofix all the issues it can, there is also eslint that has a similar ability

@alexandru-calinoiu Thnx for the tips, however, I was talking about tools that allow you to run the Roslyn analyzers/code fixers, as what this project is about.

Why was this closed? The question wasn't answered.

Being able to run a command-line Roslyn tool to do codefixes e.g. on checkin would be incredibly useful - I'm not averse to building something like that myself, but obviously if there is already an official/recommended tool that does this, I'd prefer to use it. If not, the extension points that would be needed, or pointers in the right direction, would be very welcome - although I suspect the fact that MSBuildWorkspace is still MIA (see dotnet/roslyn#17974) will be a problem.

I'm also interested to see something like that the day of light. I believe the Roslyn team(s) are working on something like that, and if it's "Fix most code style violations in the current document with a single click." on the VS 2018 roadmap, then it should be due at the end of the month ;) Though, looking at this issue, I see there is still a lot to do ;)

@IanKemp There is no officially supported mechanism to do that. If you build this repository from source, the StyleCopTester tool may be able to provide some untested/unsupported functionality that looks like this. See #2017. The version of this tool in the master branch already uses the replacement for MSBuildWorkspace.

Was this page helpful?
0 / 5 - 0 ratings