Skip to content

Commit ba471f2

Browse files
authored
Merge pull request #146 from Windos/GH-145/skip-dependencycheck-yarn-analysis
(#145) Enable skipping of Yarn analysis
2 parents 869ae83 + 3ca5aec commit ba471f2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Chocolatey.Cake.Recipe/Content/dependencyCheck.cake

+9
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ BuildParameters.Tasks.DependencyCheckTask = Task("Dependency-Check")
4646

4747
DeleteFile(BuildParameters.RootDirectoryPath.CombineWithFilePath("dependency-check.zip"));
4848

49+
if (ToolSettings.DependencyCheckDisableYarnAudit)
50+
{
51+
ReplaceTextInFiles(
52+
BuildParameters.RootDirectoryPath.Combine("tools/DependencyCheck.Runner.Tool.3.2.1/tools/bin").CombineWithFilePath("dependency-check.bat").ToString(),
53+
"org.owasp.dependencycheck.App %CMD_LINE_ARGS%",
54+
"org.owasp.dependencycheck.App --disableYarnAudit %CMD_LINE_ARGS%"
55+
);
56+
};
57+
4958
var DependencyCheckSettings = new DependencyCheckSettings {
5059
Project = BuildParameters.ProductName,
5160
Scan = BuildParameters.SourceDirectoryPath.FullPath,

Chocolatey.Cake.Recipe/Content/toolsettings.cake

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static class ToolSettings
2727
public static FilePath EazfuscatorToolLocation { get; private set; }
2828
public static string AmazonLambdaGlobalTool { get; private set; }
2929
public static string DependencyCheckTool { get; private set; }
30+
public static bool DependencyCheckDisableYarnAudit { get; private set; }
3031
public static string DotNetFormatGlobalTool { get; private set; }
3132
public static string GitVersionGlobalTool { get; private set; }
3233
public static string GitVersionTool { get; private set; }
@@ -109,7 +110,8 @@ public static class ToolSettings
109110
List<string> scriptAnalyzerExcludePaths = null,
110111
string testCoverageExcludeByAttribute = null,
111112
string testCoverageExcludeByFile = null,
112-
string testCoverageFilter = null
113+
string testCoverageFilter = null,
114+
bool dependencyCheckDisableYarnAudit = false
113115
)
114116
{
115117
context.Information("Setting up tools...");
@@ -125,6 +127,13 @@ public static class ToolSettings
125127
TestCoverageExcludeByFile = testCoverageExcludeByFile ?? "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs";
126128
TestCoverageFilter = testCoverageFilter ?? string.Format("+[{0}*]* +[{1}*]* -[*.tests]* -[*.Tests]*", BuildParameters.Title, BuildParameters.Title.ToLowerInvariant());
127129

130+
DependencyCheckDisableYarnAudit = dependencyCheckDisableYarnAudit;
131+
132+
if (context.HasArgument("dependencyCheckDisableYarnAudit"))
133+
{
134+
DependencyCheckDisableYarnAudit = context.Argument<bool>("dependencyCheckDisableYarnAudit");
135+
}
136+
128137
// We only use MSBuild when running on Windows. Elsewhere, we use XBuild when required. As a result,
129138
// we only need to detect the correct version of MSBuild when running on WIndows, and when it hasn't
130139
// been explicitly set.

0 commit comments

Comments
 (0)