Skip to content
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

.editorconfig fails to suppress analyzer warnings #42762

Open
AArnott opened this issue Mar 25, 2020 · 5 comments
Open

.editorconfig fails to suppress analyzer warnings #42762

AArnott opened this issue Mar 25, 2020 · 5 comments

Comments

@AArnott
Copy link
Contributor

AArnott commented Mar 25, 2020

Version Used: .NET Core SDK 3.1.201, VS 16.6.0 Preview 3 (29923.206.master)

Steps to Reproduce:

git clone https://github.com/AArnott/Nerdbank.Streams.git
cd Nerdbank.Streams
git checkout f5c2933e0b66b2a2ad7415c5d637ba5149d5370b
dotnet build src\Nerdbank.Streams

Expected Behavior:

No warnings for files under the ext directory.

Actual Behavior:

Many dozens of warnings under the ext\MessagePack\src\MessagePack.UnityClient\Assetes\Scripts\MessagePack direcotry.

The ext folder is where submodules are mounted, and while these add compilation inputs to the C# compiler, we can't hold them to the same style bar that our the parent repo is held to. For this reason, I have an ext\.editorconfig file that turns off all analyzers. But although I can see all the relevant .editorconfig files are passed to the compiler, the analyzers run and produce many warnings anyway.

image

@AArnott
Copy link
Contributor Author

AArnott commented Mar 25, 2020

Note that the VS in-proc compiler seems to do it right -- it doesn't produce these warnings in the error list except right after a full project build, and then when I navigate to those warnings in the editor, they disappear. So it seems it's just a bug in the out of proc (or command line) build.

@AArnott
Copy link
Contributor Author

AArnott commented Mar 25, 2020

Note if I move the content of ext\.editorconfig into the repo root .editorconfig file, the warnings go away.

@AArnott
Copy link
Contributor Author

AArnott commented Mar 25, 2020

This repros with the very latest compiler as well:

<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.6.0-1.final" PrivateAssets="all" />

AArnott added a commit to dotnet/Nerdbank.Streams that referenced this issue Mar 25, 2020
@jcouv
Copy link
Member

jcouv commented Mar 27, 2020

Tagging @agocke

@ssa3512
Copy link

ssa3512 commented Oct 21, 2020

I think I am running into a similar issue - trying to turn on some of the analyzers for my project. I added the following to .editorconfig in the root of our repository. Building locally has the expected results (no errors/no CAxxxx warnings, except for CA1824 which may be a separate issue). Our Azure DevOps hosted CI build is giving lots of CA warnings despite the editorconfig

.editorconfig:

# CA1827: Do not use Count/LongCount when Any can be used
dotnet_diagnostic.CA1827.severity = error

# CA1829: Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1829.severity = error

# Default severity for all analyzer diagnostics
dotnet_analyzer_diagnostic.severity = none

Edit: It appears this maybe version specific. I get the warnings in VS 16.7, but not in 16.8 Preview 4. Presumably the CI server isn't using a preview VS version, hence not respecting the .editorconfig

ericdotnet added a commit to ericdotnet/Streams-Nerdbank-pro that referenced this issue May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants