opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

Update all projects with `Nullable`, `AnalysisLevel`, and `ImplicitUsings`

Open TimothyMothra opened this issue 3 years ago • 4 comments

This issue is to track the effort of updating all projects to support:

<PropertyGroup>
  <Nullable>enable</Nullable>
  <AnalysisLevel>latest-All</AnalysisLevel>
  <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

We want these properties in any new projects (https://github.com/open-telemetry/opentelemetry-dotnet/pull/3933#discussion_r1029903850) and it will take some effort to update existing projects.

I'm planning to add these properties to the Common.props, as suggested here: https://github.com/open-telemetry/opentelemetry-dotnet/pull/3924#discussion_r1026975563. This will be on-by-default for all projects. Projects with too many errors can be disabled until updated.

Notes

  • AnalysisLevel found 1 error.
  • ImplicitUsings found 311 errors.
  • Nullable found at least 1526 errors. Likely hundreds more.
  • should be able to remove #nullable enable
  • need to remove all the #pragma warning disable IDE0005 introduced while fixing ImplicitUsings

Status

  • [x] <Nullable>enable</Nullable>
  • [ ] <AnalysisLevel>latest-All</AnalysisLevel> (a lot of issues, it should be enabled per project. When creating PRs consider 2 separate changes - trivial fixes, and more important as separate. It will be easier to review).
  • [x] <ImplicitUsings>enable</ImplicitUsings>

Sub Tasks

  • #4338

TimothyMothra avatar Nov 30 '22 22:11 TimothyMothra

I'm working on removing the ImplicitUsings from projects. This repo has a lot of shared files which complicates this setting. I need to remove the ImplicitUsings disable from a few projects at a time and disable the using check in shared *.cs files.

TimothyMothra avatar Dec 07 '22 17:12 TimothyMothra

The latest updates for .NET fixed AnalysisLevel, which is now reporting issues. It detected almost 1800 issues in this repo and was blocking PRs. This has been disabled in the Common.props until issues can be resolved.

TimothyMothra avatar Dec 14 '22 23:12 TimothyMothra

This issue was marked stale due to lack of activity and will be closed in 7 days. Commenting will instruct the bot to automatically remove the label. This bot runs once per day.

github-actions[bot] avatar Oct 08 '24 03:10 github-actions[bot]

Not stale, hopefully it will be done. We have only couple leftovers.

Kielek avatar Oct 08 '24 04:10 Kielek