-
Notifications
You must be signed in to change notification settings - Fork 176
Are roslyn analyzers working? #809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bigdnf Sorry you are running into issues. Can you run with |
I have tested it on new repo - for now only for IDE0005 (still not deleted unused using) dotnet-format ./ConsoleApp10.sln --fix-style warn -v diag |
I have also been unsuccessful in fixing diagnostics using this tool when setting the rule entry in an EditorConfig file:
|
@dominikjeske & @ xtwwczze Can you try build 5.0.156601 and let me know if your issue is resolved? |
@JoeRobich It seems
|
@xtqqczze I think that CimCmdlets may not have any unused usings. I added
|
Yeah, I had added an unused using. Comparing our logs, it appears as if |
@xtqqczze Can you share your branch with me where you are making the changes to .editorconfig? I want to be sure I am running against the same code as you are. |
@JoeRobich I've pushed to dotnet-format-GH809. With vagrant, I executing the following on a clean windows10 machine:
|
@JoeRobich Thanks for response - I have done some testing.
dotnet_diagnostic.SA1507.severity = warning |
We do support running 3rd party analyzers (see https://github.com/dotnet/format/tree/master/docs#3rd-party-analysis). Ensure the analyzers are added to the projects with a <PackageReference>. Ensure that NuGet restore has been run. Added note that analyzer packages set the default severity for their analyzers, so without intentional configuration you will see lots of new warnings.
|
@JoeRobich I see you have analyzers working on dotnet-format-GH809. There must be some difference in our environment, I have tried without success using a clean windows10 vm as well as WSL 2. |
I did the following:
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
If you make the configuration changes and push updates to your branch, I would be happy to try running against them. |
I don't know what I'm doing wrong but this is not working for me. I put my test project here https://github.com/dominikjeske/Samples/tree/main/DotnetFormat and log from my console. I want to remove new lines from here https://github.com/dominikjeske/Samples/blob/main/DotnetFormat/ConsoleApp8/Program.cs#L9 by the rule set here https://github.com/dominikjeske/Samples/blob/main/DotnetFormat/ConsoleApp8/.editorconfig#L6 |
@dominikjeske in your screenshot you did this: dotnet-format --fix-style warn That will only fix built-in stlye warnings. You need to do this to fix third-party analyzer warnings like stylecop: dotnet-format --fix-analyzers warn |
Yes this is it - now everything is working like a charm |
@dominikjeske Neither code style analyzers nor 3rd party analyzers are working for me.
|
For 3rd party analyzers to work you need to run a |
@JoeRobich I missed the restore in this instance, however still no files are formatted as shown by the output of
|
The |
Ah yes, of course. I have the third-party analyzers working now. The code style analyzers however are still not working:
|
@xtqqczze What errors are you expecting to be reported? I cloned the Samples repo and checked out the SHA from you logs. Like you no violations were reported. I then added |
My bad, I had assumed there were already some style violations in @dominikjeske's project. All seems to be working now. Tomorrow I will try again on PowerShell repo. |
This seems to be a common mistake. Can it always run by default as it is done at compilation? |
I'm not sure if Roslyn analyzers should already work in current version 5.0.146101. I have tried those:
dotnet_diagnostic.IDE0005.severity = warning
dotnet_diagnostic.SA1507.severity = warning
Visual studio is showing hints for fixing errors but after run:
dotnet format --fix-style warn
nothing is fixed ;(
The text was updated successfully, but these errors were encountered: