Skip to content

Commit

Permalink
Add support for TAP format (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger authored Jan 16, 2025
1 parent d16c24a commit 30a2bc1
Show file tree
Hide file tree
Showing 8 changed files with 755 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ For recipe compatible with Cake Script Runners see Cake.Issues.Recipe.</Descript
<PackageReference Include="Cake.Frosting.Issues.Markdownlint" Version="5.4.0" />
<PackageReference Include="Cake.Frosting.Issues.MsBuild" Version="5.4.0" />
<PackageReference Include="Cake.Frosting.Issues.Sarif" Version="5.4.0" />
<PackageReference Include="Cake.Frosting.Issues.Tap" Version="5.4.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests" Version="5.4.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.AppVeyor" Version="5.4.0" />
<PackageReference Include="Cake.Frosting.Issues.PullRequests.AzureDevOps" Version="5.4.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,36 @@ public interface IIssuesParametersInputFiles
/// </summary>
IDictionary<byte[], IReadIssuesSettings> SarifLogFileContent { get; }

/// <summary>
/// Gets list of registered paths to TAP log files.
/// </summary>
IDictionary<FilePath, IReadIssuesSettings> GenericTapLogFilePaths { get; }

/// <summary>
/// Gets list of registered content of TAP log files.
/// </summary>
IDictionary<byte[], IReadIssuesSettings> GenericTapLogFileContent { get; }

/// <summary>
/// Gets list of registered paths to Stylelint TAP log files.
/// </summary>
IDictionary<FilePath, IReadIssuesSettings> StylelintTapLogFilePaths { get; }

/// <summary>
/// Gets list of registered content of Stylelint TAP log files.
/// </summary>
IDictionary<byte[], IReadIssuesSettings> StylelintTapLogFileContent { get; }

/// <summary>
/// Gets list of registered paths to Textlint TAP log files.
/// </summary>
IDictionary<FilePath, IReadIssuesSettings> TextlintTapLogFilePaths { get; }

/// <summary>
/// Gets list of registered content of Textlint TAP log files.
/// </summary>
IDictionary<byte[], IReadIssuesSettings> TextlintTapLogFileContent { get; }

/// <summary>
/// Adds a path to a MSBuild log file created by XmlFileLogger.
/// </summary>
Expand Down Expand Up @@ -198,4 +228,46 @@ public interface IIssuesParametersInputFiles
/// <param name="logfileContent">Content of the SARIF log file.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
void AddSarifLogFileContent(byte[] logfileContent, IReadIssuesSettings settings);

/// <summary>
/// Adds a path to a log file in Test Anything Protocol format.
/// </summary>
/// <param name="logfilePath">Path to the log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
void AddGenericTapLogFilePath(FilePath logfilePath, IReadIssuesSettings settings);

/// <summary>
/// Adds content of a log file in Test Anything Protocol format.
/// </summary>
/// <param name="logfileContent">Content of the log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
void AddGenericTapLogFileContent(byte[] logfileContent, IReadIssuesSettings settings);

/// <summary>
/// Adds a path to a Stylelint log file in Test Anything Protocol format.
/// </summary>
/// <param name="logfilePath">Path to the Stylelint log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
void AddStylelintTapLogFilePath(FilePath logfilePath, IReadIssuesSettings settings);

/// <summary>
/// Adds content of a Stylelint log file in Test Anything Protocol format.
/// </summary>
/// <param name="logfileContent">Content of the Stylelint log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
void AddStylelintTapLogFileContent(byte[] logfileContent, IReadIssuesSettings settings);

/// <summary>
/// Adds a path to a Textlint log file in Test Anything Protocol format.
/// </summary>
/// <param name="logfilePath">Path to the Textlint log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
void AddTextlintTapLogFilePath(FilePath logfilePath, IReadIssuesSettings settings);

/// <summary>
/// Adds content of a Textlint log file in Test Anything Protocol format.
/// </summary>
/// <param name="logfileContent">Content of the Textlint log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
void AddTextlintTapLogFileContent(byte[] logfileContent, IReadIssuesSettings settings);
}
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,202 @@ public static void AddSarifLogFileContent(
}

#endregion

#region GenericTapLogFile

/// <summary>
/// Adds a path to a log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfilePath">Path to the log file in Test Anything Protocol format.</param>
public static void AddGenericTapLogFilePath(
this IIssuesParametersInputFiles parameters,
FilePath logfilePath)
{
parameters.NotNull();
logfilePath.NotNull();

parameters.AddGenericTapLogFilePath(logfilePath, null);
}

/// <summary>
/// Adds content of a log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the log file in Test Anything Protocol format.</param>
public static void AddGenericTapLogFileContent(
this IIssuesParametersInputFiles parameters,
string logfileContent)
{
parameters.NotNull();
logfileContent.NotNullOrWhiteSpace();

parameters.AddGenericTapLogFileContent(logfileContent.ToByteArray(), null);
}

/// <summary>
/// Adds content of a log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the log file in Test Anything Protocol format.</param>
public static void AddGenericTapLogFileContent(
this IIssuesParametersInputFiles parameters,
byte[] logfileContent)
{
parameters.NotNull();
logfileContent.NotNullOrEmpty();

parameters.AddGenericTapLogFileContent(logfileContent, null);
}

/// <summary>
/// Adds content of a log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
public static void AddGenericTapLogFileContent(
this IIssuesParametersInputFiles parameters,
string logfileContent,
IReadIssuesSettings settings)
{
parameters.NotNull();
logfileContent.NotNullOrEmpty();

parameters.AddGenericTapLogFileContent(logfileContent.ToByteArray(), settings);
}

#endregion

#region StylelintTapLogFile

/// <summary>
/// Adds a path to a Stylelint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfilePath">Path to the Stylelint log file in Test Anything Protocol format.</param>
public static void AddStylelintTapLogFilePath(
this IIssuesParametersInputFiles parameters,
FilePath logfilePath)
{
parameters.NotNull();
logfilePath.NotNull();

parameters.AddStylelintTapLogFilePath(logfilePath, null);
}

/// <summary>
/// Adds content of a Stylelint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the Stylelint log file in Test Anything Protocol format.</param>
public static void AddStylelintTapLogFileContent(
this IIssuesParametersInputFiles parameters,
string logfileContent)
{
parameters.NotNull();
logfileContent.NotNullOrWhiteSpace();

parameters.AddStylelintTapLogFileContent(logfileContent.ToByteArray(), null);
}

/// <summary>
/// Adds content of a Stylelint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the Stylelint log file in Test Anything Protocol format.</param>
public static void AddStylelintTapLogFileContent(
this IIssuesParametersInputFiles parameters,
byte[] logfileContent)
{
parameters.NotNull();
logfileContent.NotNullOrEmpty();

parameters.AddStylelintTapLogFileContent(logfileContent, null);
}

/// <summary>
/// Adds content of a Stylelint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the Stylelint log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
public static void AddStylelintTapLogFileContent(
this IIssuesParametersInputFiles parameters,
string logfileContent,
IReadIssuesSettings settings)
{
parameters.NotNull();
logfileContent.NotNullOrEmpty();

parameters.AddStylelintTapLogFileContent(logfileContent.ToByteArray(), settings);
}

#endregion

#region TextlintTapLogFile

/// <summary>
/// Adds a path to a Textlint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfilePath">Path to the Textlint log file in Test Anything Protocol format.</param>
public static void AddTextlintTapLogFilePath(
this IIssuesParametersInputFiles parameters,
FilePath logfilePath)
{
parameters.NotNull();
logfilePath.NotNull();

parameters.AddTextlintTapLogFilePath(logfilePath, null);
}

/// <summary>
/// Adds content of a Textlint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the Textlint log file in Test Anything Protocol format.</param>
public static void AddTextlintTapLogFileContent(
this IIssuesParametersInputFiles parameters,
string logfileContent)
{
parameters.NotNull();
logfileContent.NotNullOrWhiteSpace();

parameters.AddTextlintTapLogFileContent(logfileContent.ToByteArray(), null);
}

/// <summary>
/// Adds content of a Textlint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the Textlint log file in Test Anything Protocol format.</param>
public static void AddTextlintTapLogFileContent(
this IIssuesParametersInputFiles parameters,
byte[] logfileContent)
{
parameters.NotNull();
logfileContent.NotNullOrEmpty();

parameters.AddTextlintTapLogFileContent(logfileContent, null);
}

/// <summary>
/// Adds content of a Textlint log file in Test Anything Protocol format.
/// </summary>
/// <param name="parameters">Parameter instance.</param>
/// <param name="logfileContent">Content of the Textlint log file in Test Anything Protocol format.</param>
/// <param name="settings">Settings for reading the log file. <c>Null</c> for default values.</param>
public static void AddTextlintTapLogFileContent(
this IIssuesParametersInputFiles parameters,
string logfileContent,
IReadIssuesSettings settings)
{
parameters.NotNull();
logfileContent.NotNullOrEmpty();

parameters.AddTextlintTapLogFileContent(logfileContent.ToByteArray(), settings);
}

#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ public class IssuesParametersInputFiles : IIssuesParametersInputFiles
/// <inheritdoc />
public IDictionary<byte[], IReadIssuesSettings> SarifLogFileContent { get; } = new Dictionary<byte[], IReadIssuesSettings>();

/// <inheritdoc />
public IDictionary<FilePath, IReadIssuesSettings> GenericTapLogFilePaths { get; } = new Dictionary<FilePath, IReadIssuesSettings>();

/// <inheritdoc />
public IDictionary<byte[], IReadIssuesSettings> GenericTapLogFileContent { get; } = new Dictionary<byte[], IReadIssuesSettings>();

/// <inheritdoc />
public IDictionary<FilePath, IReadIssuesSettings> StylelintTapLogFilePaths { get; } = new Dictionary<FilePath, IReadIssuesSettings>();

/// <inheritdoc />
public IDictionary<byte[], IReadIssuesSettings> StylelintTapLogFileContent { get; } = new Dictionary<byte[], IReadIssuesSettings>();

/// <inheritdoc />
public IDictionary<FilePath, IReadIssuesSettings> TextlintTapLogFilePaths { get; } = new Dictionary<FilePath, IReadIssuesSettings>();

/// <inheritdoc />
public IDictionary<byte[], IReadIssuesSettings> TextlintTapLogFileContent { get; } = new Dictionary<byte[], IReadIssuesSettings>();

/// <inheritdoc />
public void AddMsBuildXmlFileLoggerLogFilePath(FilePath logfilePath, IReadIssuesSettings settings)
{
Expand Down Expand Up @@ -238,4 +256,73 @@ public void AddSarifLogFileContent(byte[] logfileContent, IReadIssuesSettings se

this.SarifLogFileContent.Add(logfileContent, settings);
}

/// <inheritdoc />
public void AddGenericTapLogFilePath(FilePath logfilePath, IReadIssuesSettings settings)
{
logfilePath.NotNull();

if (this.GenericTapLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the Generic TAP issue provider.",
nameof(logfilePath));
}

this.GenericTapLogFilePaths.Add(logfilePath, settings);
}

/// <inheritdoc />
public void AddGenericTapLogFileContent(byte[] logfileContent, IReadIssuesSettings settings)
{
logfileContent.NotNullOrEmpty();

this.GenericTapLogFileContent.Add(logfileContent, settings);
}

/// <inheritdoc />
public void AddStylelintTapLogFilePath(FilePath logfilePath, IReadIssuesSettings settings)
{
logfilePath.NotNull();

if (this.StylelintTapLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the Stylelint TAP issue provider.",
nameof(logfilePath));
}

this.StylelintTapLogFilePaths.Add(logfilePath, settings);
}

/// <inheritdoc />
public void AddStylelintTapLogFileContent(byte[] logfileContent, IReadIssuesSettings settings)
{
logfileContent.NotNullOrEmpty();

this.StylelintTapLogFileContent.Add(logfileContent, settings);
}

/// <inheritdoc />
public void AddTextlintTapLogFilePath(FilePath logfilePath, IReadIssuesSettings settings)
{
logfilePath.NotNull();

if (this.StylelintTapLogFilePaths.ContainsKey(logfilePath))
{
throw new ArgumentException(
$"The path '{logfilePath.FullPath}' is already registered for the Textlint TAP issue provider.",
nameof(logfilePath));
}

this.StylelintTapLogFilePaths.Add(logfilePath, settings);
}

/// <inheritdoc />
public void AddTextlintTapLogFileContent(byte[] logfileContent, IReadIssuesSettings settings)
{
logfileContent.NotNullOrEmpty();

this.StylelintTapLogFileContent.Add(logfileContent, settings);
}
}
Loading

0 comments on commit 30a2bc1

Please sign in to comment.