Disable CodeStyle analyzers by default in all explicit builds of Roslyn.sln (i.e. csc/vbc invocations both inside Visual Studio and from command line prompt)#43303
Conversation
|
What is the motivation for doing this? Today the code style analyzers only run as part of our build correctness leg. They are disabled for all other legs. The motivation behind that split is exactly what you're laying out here:
|
|
Basically if we do this how will code style get verified as a part of our CI process? |
Faster local builds for each developer. |
|
The PR says
CI refers to continuous integration aka AzDO. This does not generally refer to developer inner loop.s |
|
The description of the PR, the implementation and the discussion here all disagree on what this PR is doing. |
Fixed now, I meant to state disable by default for command line builds |
|
|
||
| <!-- Workaround for https://github.com/dotnet/roslyn/issues/42166 --> | ||
| <!-- PERF: This property group prevents the analyzers from CodeStyle NuGet package from being executed by default in CI --> | ||
| <PropertyGroup Condition="'$(DesignTimeBuild)' != 'true'"> |
There was a problem hiding this comment.
If we want this to be enabled for continuous integration only then we should use '$(ContinuousIntegration)' != 'true'. That is the standard way of conditioning data on CI.
There was a problem hiding this comment.
That would also disable all these analyzers for design time builds/IDE live analysis, we do not want that.
There was a problem hiding this comment.
Who is "we" here? This is definitely what a good portion of the compiler team wants for exactly what you laid out in this email. I want my inner loop fast including building from Visual Studio.
There was a problem hiding this comment.
design time build == live analysis during typing. If we make your suggested change, we will not execute these analyzers even during typing and see no suggestions.
Why command line builds here and not Visual Studio? The biggest source of complaints I've seen about code style build time is in Visual Studio, not the command line. In the command line if you don't care about code style then just use |
jaredpar
left a comment
There was a problem hiding this comment.
This is impacting how the overall build of Roslyn works and it hasn't really been discussed with the team. The biggest complaint we've had internally about build perf time is around building from Visual Studio, not from the command line.
There are about 70+ code style analyzers in this NuGet package, all of them reporting hidden diagnostics by default. We have only enforced 2 analyzers from this NuGet package as warnings in build (formatting and file header analyzer), but due to #42166, all of these 70+ analyzers are running on every command line build of Roslyn on every developer's machine, adding to build time overhead. Except for the explicitly enforced analyzers (current the two mentioned above), execution of rest of code style analyzers is just an unnecessary build time overhead - hidden diagnostics are never reported on command line build. This change aims at removing that overhead from command line builds. |
Who is complaining about this? This is the crux of my confusion here. For developers who build from the command line there is already a solution for exactly this: This is frustrating because we have several active threads going on right now about the usability of Visual Studio given the negative performance of our analyzers. Developers who are actively blocked in their work. Yet instead of addressing that (build from VS) we're sending PRs to disable build from command line (which I haven't seen anyone complain about). Am I missing the complaints? |
I think the confusion is in the wordings that I used in this PR. Sorry, let me try to clarify:
|
| <!-- Workaround for https://github.com/dotnet/roslyn/issues/42166 --> | ||
| <!-- PERF: This property group prevents the analyzers from CodeStyle NuGet package from being executed by default in all explicit builds (i.e. csc/vbc invocations both inside Visual Studio and from command line prompt) --> | ||
| <PropertyGroup Condition="'$(DesignTimeBuild)' != 'true'"> | ||
| <NoWarn>$(NoWarn);IDE0004;IDE0004WithoutSuggestion;IDE0005;IDE0007;IDE0007WithoutSuggestion;IDE0008;IDE0008WithoutSuggestion;IDE0009;IDE0009WithoutSuggestion;IDE0010;IDE0010WithoutSuggestion;IDE0011;IDE0011WithoutSuggestion;IDE0016;IDE0016WithoutSuggestion;IDE0017;IDE0017WithoutSuggestion;IDE0018;IDE0018WithoutSuggestion;IDE0019;IDE0019WithoutSuggestion;IDE0020;IDE0020WithoutSuggestion;IDE0021;IDE0022;IDE0023;IDE0024;IDE0025;IDE0026;IDE0027;IDE0028;IDE0028WithoutSuggestion;IDE0029;IDE0029WithoutSuggestion;IDE0030;IDE0030WithoutSuggestion;IDE0031;IDE0031WithoutSuggestion;IDE0032;IDE0032WithoutSuggestion;IDE0033;IDE0033WithoutSuggestion;IDE0034;IDE0034WithoutSuggestion;IDE0035;IDE0035WithoutSuggestion;IDE0036;IDE0036WithoutSuggestion;IDE0037;IDE0037WithoutSuggestion;IDE0040;IDE0040WithoutSuggestion;IDE0041;IDE0041WithoutSuggestion;IDE0042;IDE0042WithoutSuggestion;IDE0043;IDE0044;IDE0044WithoutSuggestion;IDE0045;IDE0045WithoutSuggestion;IDE0046;IDE0046WithoutSuggestion;IDE0047;IDE0048;IDE0048WithoutSuggestion;IDE0050;IDE0050WithoutSuggestion;IDE0051;IDE0052;IDE0054;IDE0054WithoutSuggestion;IDE0055;IDE0056;IDE0056WithoutSuggestion;IDE0057;IDE0057WithoutSuggestion;IDE0058;IDE0059;IDE0060;IDE0061;IDE0062;IDE0062WithoutSuggestion;IDE0063;IDE0063WithoutSuggestion;IDE0064;IDE0065;IDE0066;IDE0066WithoutSuggestion;IDE0070;IDE0070WithoutSuggestion;IDE0071;IDE0071WithoutSuggestion;IDE0072;IDE0072WithoutSuggestion;IDE0073;IDE0073WithoutSuggestion;IDE0074;IDE0074WithoutSuggestion;IDE0075;IDE0075WithoutSuggestion;IDE1005;IDE1005WithoutSuggestion;IDE1006;IDE1006WithoutSuggestion</NoWarn> |
There was a problem hiding this comment.
How does adding these to $(NoWarn) disable the diagnostic?
There was a problem hiding this comment.
If all diagnostics reported by an analyzer are disabled (via nowarn or ruleset) then the analyzer is completely skipped for execution.
There was a problem hiding this comment.
How does this interact with the editor config change which bumps them all back to warning?
There was a problem hiding this comment.
We currently enforce only 2 of these as warnings in Roslyn's editorconfig (file header and formatting analyzer). Editorconfig based settings always take precedence over compilation options (nowarn and ruleset settings). So those 2 analyzers will run everywhere, and rest will only run while typing in the IDE.
|
Thanks! |
Workaround for #42166
This change brings down the local build time for Roslyn.sln on my machine from around
8 minsto5 mins. I am going to file separate bugs with performance traces for slow IDE analyzers in CodeStyle NuGet package.