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

[sdk] Remove redundant NotNullWhen in SelfDiagnosticsConfigParser.TryParseLogDirectory #6073

Conversation

SimonCropp
Copy link
Contributor

Changes

logDirectoryResult.Groups["LogDirectory"].Value; can never return null. which is clear by the fact that string logDirectory is not string? logDirectory and it doesnt warn.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@SimonCropp SimonCropp requested a review from a team as a code owner January 17, 2025 22:49
@github-actions github-actions bot added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label Jan 17, 2025
Copy link
Contributor

@Kielek Kielek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with this or, whole method as

    internal static bool TryParseLogDirectory(
        string configJson,
        [NotNullWhen(true)]
        out string? logDirectory)
    {
        var logDirectoryResult = LogDirectoryRegex.Match(configJson);
        if (!logDirectoryResult.Success)
        {
            logDirectory = null;
            return false;
        }

        logDirectory = logDirectoryResult.Groups["LogDirectory"].Value;
        return !string.IsNullOrWhiteSpace(logDirectory);
    }

@SimonCropp
Copy link
Contributor Author

in keeping with "make smallest possible change to fix a problem" i would prefer to leave the PR as is. would prefer a lerger cleanup of the method to be done in a diff PR

@CodeBlanch CodeBlanch changed the title remove redundant NotNullWhen in TryParseLogDirectory [sdk] Remove redundant NotNullWhen in SelfDiagnosticsConfigParser.TryParseLogDirectory Jan 22, 2025
@CodeBlanch CodeBlanch merged commit d9864b1 into open-telemetry:main Jan 22, 2025
39 checks passed
Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.39%. Comparing base (54f7d9e) to head (e40329b).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #6073   +/-   ##
=======================================
  Coverage   86.39%   86.39%           
=======================================
  Files         257      257           
  Lines       11650    11650           
=======================================
  Hits        10065    10065           
  Misses       1585     1585           
Files with missing lines Coverage Δ
...nTelemetry/Internal/SelfDiagnosticsConfigParser.cs 85.71% <ø> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants