libgit2 / libgit2/libgit2sharp

Throw when xxxOptions are null

Open
#1,076 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Easy fix Stabilization Up for grabs
Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

From https://github.com/libgit2/libgit2sharp/pull/1068/files#r31650592

We rely on the following pattern throughout the codebase.

public Things DoThings()
{
     return DoThings(null);
}

public Things DoThings(ThingsOptions options)
{
     options = options ?? new ThingsOptions();
     [...]
}

Let's change this to the following one

public Things DoThings()
{
     return DoThings(new ThingsOptions());
}

public Things DoThings(ThingsOptions options)
{
     Ensure.ArgumentNotNull(options);
     [...]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the C# codebase for overloads that accept xxxOptions and currently replace null with a new options instance. Review the referenced pull request discussion first, then identify every affected overload and its parameterless counterpart. Done means these overloads reject null options while parameterless calls construct the default options object.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.