Skip to content

Commit

Permalink
C# liniting
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Jan 20, 2025
1 parent ce33eca commit 292edea
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
8 changes: 8 additions & 0 deletions AltCover.Cake/Cake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ public static int Collect(this ICakeContext context, Abstract.ICollectOptions co
[CakeMethodAlias]
public static string ImportModule(this ICakeContext context)
{
#if NET8_0_OR_GREATER
ArgumentNullException.ThrowIfNull(context, nameof(context));
#else
if (context == null) throw new System.ArgumentNullException(nameof(context));
#endif
return FSCommand.ImportModule();
}

Expand All @@ -92,7 +96,11 @@ public static string ImportModule(this ICakeContext context)
[CakeMethodAlias]
public static System.Version Version(this ICakeContext context)
{
#if NET8_0_OR_GREATER
ArgumentNullException.ThrowIfNull(context, nameof(context));
#else
if (context == null) throw new System.ArgumentNullException(nameof(context));
#endif
return FSCommand.Version();
}
}
Expand Down
17 changes: 12 additions & 5 deletions AltCover.Cake/CakeMix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace Cake.Core
{
[EditorBrowsable(EditorBrowsableState.Never)]
Expand Down Expand Up @@ -45,17 +46,19 @@ namespace Cake.Core.IO
[EditorBrowsable(EditorBrowsableState.Never)]
public class ProcessArgumentBuilder
{
public void Append(string s)
#pragma warning disable CA1822 // Mark members as static
public void Append(string _)
{ }

public void Append(IProcessArgument s)
public void Append(IProcessArgument _)
{ }

public IEnumerable<IProcessArgument> Skip(int n)
public IEnumerable<IProcessArgument> Skip(int _)
{ return null; }

public IEnumerable<IProcessArgument> Take(int n)
public IEnumerable<IProcessArgument> Take(int _)
{ return null; }
#pragma warning restore CA1822 // Mark members as static
}

[EditorBrowsable(EditorBrowsableState.Never)]
Expand All @@ -65,11 +68,13 @@ public interface IProcessArgument
[EditorBrowsable(EditorBrowsableState.Never)]
public class FilePath
{
#pragma warning disable CA1822 // Mark members as static
public FilePath GetFilename()
{ return null; }

public string FullPath
{ get { return String.Empty; } }
#pragma warning restore CA1822 // Mark members as static
}
}

Expand All @@ -84,7 +89,7 @@ public class CakeMethodAliasAttribute : Attribute
[AttributeUsage(AttributeTargets.All)]
public class CakeAliasCategoryAttribute : Attribute
{
public CakeAliasCategoryAttribute(string s)
public CakeAliasCategoryAttribute(string _)
{ }
}
}
Expand All @@ -95,9 +100,11 @@ namespace Cake.Common.Tools.DotNet
public static class DotNetAliases
{
public static void DotNetTest(
#pragma warning disable IDE0060 // Remove unused parameter
Cake.Core.ICakeContext context,
string fullPath,
Cake.Common.Tools.DotNet.Test.DotNetTestSettings testSettings)
#pragma warning restore IDE0060 // Remove unused parameter
{ }
}
}
Expand Down
8 changes: 8 additions & 0 deletions AltCover.Cake/DotNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public AltCover.ValidatedCommandLine WhatIf()
return collect;
}

#pragma warning disable IDE0301 // Collection initialization
return new AltCover.ValidatedCommandLine(FSharpList<string>.Empty, Enumerable.Empty<string>());
#pragma warning restore IDE0301 // Collection initialization
}

/// <summary>
Expand Down Expand Up @@ -141,9 +143,15 @@ public static void DotNetTest(
DotNetTestSettings testSettings,
CoverageSettings coverageSettings)
{
#if NET8_0_OR_GREATER
ArgumentNullException.ThrowIfNull(project, nameof(project));
ArgumentNullException.ThrowIfNull(testSettings, nameof(testSettings));
ArgumentNullException.ThrowIfNull(coverageSettings, nameof(coverageSettings));
#else
if (project == null) throw new ArgumentNullException(nameof(project));
if (testSettings == null) throw new ArgumentNullException(nameof(testSettings));
if (coverageSettings == null) throw new ArgumentNullException(nameof(coverageSettings));
#endif

testSettings.ArgumentCustomization = coverageSettings.Concatenate(testSettings.ArgumentCustomization);

Expand Down
8 changes: 8 additions & 0 deletions AltCover.Cake/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public class PrepareOptions : Abstract.IPrepareOptions
Justification = "Property name")]
public IEnumerable<string> OutputDirectories => throw new NotImplementedException("OutputDirectories not used");

#pragma warning disable IDE0301 // Collection initialization

///<summary>
/// Corresponds to command line option `-y, --symbolDirectory=VALUE`
///</summary>
Expand Down Expand Up @@ -263,6 +265,8 @@ public class PrepareOptions : Abstract.IPrepareOptions
/// Corresponds to command line option `--portable`
///</summary>
public virtual bool Portable => false;

#pragma warning restore IDE0301 // Collection initialization
}

/// <summary>
Expand Down Expand Up @@ -326,11 +330,15 @@ public class CollectOptions : Abstract.ICollectOptions
Justification = "Lcov is a name")]
public virtual string Cobertura => String.Empty;

#pragma warning disable IDE0301 // Collection initialization

///<summary>
/// Corresponds to command line option `-p, --package=VALUE`
///</summary>
public IEnumerable<string> Packages => Enumerable.Empty<string>();

#pragma warning restore IDE0301 // Collection initialization

///<summary>
/// Corresponds to command line option `-o, --outputFile=VALUE`
///</summary>
Expand Down

0 comments on commit 292edea

Please sign in to comment.