Skip to content

Commit

Permalink
Merge pull request #318 from Takoooooo/ide-based-skips
Browse files Browse the repository at this point in the history
feat: Skip checks based on which IDE runs uno-check
  • Loading branch information
Takoooooo authored Dec 17, 2024
2 parents d5dbbbe + 4704c76 commit ddc4c66
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
18 changes: 18 additions & 0 deletions UnoCheck/CheckCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,24 @@ public override async Task<int> ExecuteAsync(CommandContext context, CheckSettin
sharedState.SetEnvironmentVariable("CI", "true");
if (settings.Frameworks is { Length: > 0 })
settings.TargetPlatforms = ParseTfmsToTargetPlatforms(settings);
if (!string.IsNullOrEmpty(settings.Ide))
{
var currentSkips = settings.Skip?.ToList() ?? [];

switch (settings.Ide.ToLowerInvariant())
{
case "rider":
currentSkips.AddRange(Util.RiderSkips);
break;
case "vs":
currentSkips.AddRange(Util.VSSkips);
break;
case "vscode":
currentSkips.AddRange(Util.VSCodeSkips);
break;
}
settings.Skip = currentSkips.Distinct().ToArray();
}

sharedState.ContributeState(StateKey.EntryPoint, StateKey.TargetPlatforms, TargetPlatformHelper.GetTargetPlatformsFromFlags(settings.TargetPlatforms));

Expand Down
5 changes: 5 additions & 0 deletions UnoCheck/CheckSettings.Uno.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@ partial class CheckSettings
[Description(
@"Run checks for a specific TFM. Use the --framework option multiple times to run checks for multiple TFM's, or omit it to run checks for all supported platforms.")]
public string[]? Frameworks { get; set; }

[CommandOption("--ide <IDE_NAME>")]
[Description(
@"This parameter skips some checks based on the IDE which is used to run the Uno.Check.")]
public string? Ide { get; set; }
}
}
5 changes: 3 additions & 2 deletions UnoCheck/CheckSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Spectre.Console.Cli;
#nullable enable
using Spectre.Console.Cli;
using System.ComponentModel;

namespace DotNetCheck
Expand All @@ -15,7 +16,7 @@ public partial class CheckSettings : CommandSettings, IManifestChannelSettings
public bool NonInteractive { get; set; }

[CommandOption("-s|--skip <CHECKUP_ID>")]
public string[] Skip { get; set; }
public string[]? Skip { get; set; }

[CommandOption("--pre|--preview|-d|--dev")]
public bool Preview { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion UnoCheck/Util.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
Expand All @@ -10,6 +9,9 @@ namespace DotNetCheck
{
public class Util
{
public static string[] RiderSkips = ["vswin","vswinworkloads", "dotnetnewunotemplates"];
public static string[] VSCodeSkips = ["vswin","vswinworkloads"];
public static string[] VSSkips = ["dotnetnewunotemplates"];
public static void LogAlways(string message)
{
Console.WriteLine(message);
Expand Down

0 comments on commit ddc4c66

Please sign in to comment.