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

Add null check for values with null as default value #2531

Merged

Conversation

aklefdal
Copy link
Contributor

@aklefdal aklefdal commented Jun 30, 2020

Description

Added null check for values with null as default value

Considerations

  • Consider making the fields optional instead using nulls, which would be a breaking change
  • Consider other ways of doing the null check, as I don't know the preferred way in this repo:
    // Using ofObj
    parameters.AccessKey |> Option.ofObj |> Option.iter (TraceSecrets.register "<NuGetKey>")

    // Using null compare
    if parameters.AccessKey <> null then TraceSecrets.register "<NuGetKey>" parameters.AccessKey

    // Using match expression
    match parameters.AccessKey with
    | null -> ()
    | key -> TraceSecrets.register "<NuGetKey>" key
  • [-] New (API-)documentation for new features exist (Note: API-docs are enough, additional docs are in help/markdown)
  • [-] unit or integration test exists (or short reasoning why it doesn't make sense)
  • [-] boy scout rule: "leave the code behind in a better state than you found it" (fix warnings, obsolete members or code-style in the places you worked in)
  • [-] (if new module) the module has been linked from the "Modules" menu, edit help/templates/template.cshtml, linking to the API-reference is fine.
  • [-] (if new module) the module is in the correct namespace
  • [-] (if new module) the module is added to Fake.sln (dotnet sln Fake.sln add src/app/Fake.*/Fake.*.fsproj)
  • Fake 5 API guideline is honored

Copy link
Contributor

@SteveGilham SteveGilham left a comment

Choose a reason for hiding this comment

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

The isNull function is the idiomatic way of making this check in the general case, but as both values are strings expected to contain encoded key material, String.IsNullOrEmpty or String.IsNullOrWhiteSpace would do the required work and skip some obviously invalid values beside.

@matthid matthid merged commit 5ebaada into fsprojects:release/next Aug 5, 2020
@matthid
Copy link
Member

matthid commented Aug 5, 2020

Thanks, sorry for taking a bit longer to get back to this

@matthid matthid mentioned this pull request Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ArgumentNullException in Fake.DotNet.NuGet.NuGet.NuGet
3 participants