Skip to content

Commit

Permalink
fix(execution): check if nullable parameter type is assignable to IAb…
Browse files Browse the repository at this point in the history
…solutePathHolder
  • Loading branch information
matkoch committed Aug 30, 2023
1 parent 1478d02 commit c74db2f
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json.Linq;
using Nuke.Common.CI;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Utilities;
using Nuke.Common.Utilities.Collections;
using Nuke.Common.ValueInjection;
Expand Down Expand Up @@ -48,11 +48,10 @@ string DecryptValue(string profile, string name, string value)
name);

// TODO: Abstract AbsolutePath/Solution/Project etc.
string ConvertValue(Type scalarType, string value)
=> scalarType.IsAssignableTo(typeof(IAbsolutePathHolder))
? PathConstruction.HasPathRoot(value)
? value
: EnvironmentInfo.WorkingDirectory.GetUnixRelativePathTo(Build.RootDirectory / value)
string ConvertValue([CanBeNull] Type scalarType, string value)

Check notice on line 51 in source/Nuke.Build/Execution/Extensions/ArgumentsFromParametersFileAttribute.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Put local function after 'return' or 'continue'

Put local function 'ConvertValue' after 'return'
=> typeof(IAbsolutePathHolder).IsAssignableFrom(scalarType) &&
!PathConstruction.HasPathRoot(value)
? EnvironmentInfo.WorkingDirectory.GetUnixRelativePathTo(Build.RootDirectory / value)
: value;

var arguments = GetParameters().SelectMany(x => ConvertToArguments(x.Profile, x.Name, x.Values)).ToArray();
Expand Down

0 comments on commit c74db2f

Please sign in to comment.