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

Should RunSpec._overrides be nullable #8083

Open
SimonCropp opened this issue Jun 11, 2024 · 0 comments
Open

Should RunSpec._overrides be nullable #8083

SimonCropp opened this issue Jun 11, 2024 · 0 comments

Comments

@SimonCropp
Copy link
Contributor

https://github.com/dotnet/templating/blob/main/src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/RunSpec.cs

internal class RunSpec : IRunSpec
{
    private readonly IReadOnlyList<IOperationProvider> _overrides;

    internal RunSpec(IReadOnlyList<IOperationProvider> operationOverrides, string? variableFormatString)
    {
        _overrides = operationOverrides;
        VariableFormatString = variableFormatString ?? "{0}";
    }

    public string VariableFormatString { get; }

    public bool TryGetTargetRelPath(string sourceRelPath, out string? targetRelPath)
    {
        targetRelPath = null;
        return false;
    }

    public IReadOnlyList<IOperationProvider> GetOperations(IReadOnlyList<IOperationProvider> sourceOperations)
    {
        return _overrides ?? sourceOperations;
    }
}

since _overrides the ?? sourceOperations part of GetOperations should never be executed.

What am i missing here?

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

No branches or pull requests

1 participant