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

feat: Skip checks based on which IDE runs uno-check #318

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -6,7 +7,7 @@
public partial class CheckSettings : CommandSettings, IManifestChannelSettings
{
[CommandOption("-m|--manifest <FILE_OR_URL>")]
public string Manifest { get; set; }

Check warning on line 10 in UnoCheck/CheckSettings.cs

View workflow job for this annotation

GitHub Actions / Build

Non-nullable property 'Manifest' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[CommandOption("-f|--fix")]
public bool Fix { get; set; }
Expand All @@ -15,7 +16,7 @@
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 All @@ -27,7 +28,7 @@
public bool Main { get; set; }

[CommandOption("--dotnet <SDK_ROOT>")]
public string DotNetSdkRoot { get; set; }

Check warning on line 31 in UnoCheck/CheckSettings.cs

View workflow job for this annotation

GitHub Actions / Build

Non-nullable property 'DotNetSdkRoot' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

[CommandOption("--force-dotnet")]
public bool ForceDotNet { 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
Loading