From 8f7dc9746d6b62c798c2ab24d63592629c9b24df Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:18:14 -0800 Subject: [PATCH 1/7] Fix incorrect inversion in LanguageRuleMap codepath --- DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs index f0e381b8..cb2db7d5 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs @@ -424,7 +424,7 @@ void parseFileEntry(FileEntry fileEntry) if (serializedAnalyzeCommandOptions.LanguageRuleIgnoreMap.TryGetValue(languageInfo.Name, out List? maybeRulesToIgnore) && maybeRulesToIgnore is { } rulesToIgnore) { - var numRemoved = issues.RemoveAll(x => !rulesToIgnore.Contains(x.Rule.Id)); + var numRemoved = issues.RemoveAll(x => rulesToIgnore.Contains(x.Rule.Id)); _logger.LogDebug($"Removed {numRemoved} results because of language rule filters."); } } From bbd35aed8368d0ab4937ed99a3a3ef2c9e3479d6 Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:21:55 -0800 Subject: [PATCH 2/7] Improve option operation tests --- .../Microsoft.DevSkim.Tests/OptionsTests.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs index ade9c392..f91233e2 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs @@ -29,7 +29,8 @@ public void TestParsingJsonOptions() Globs = new List() {"*.js"} }; // Serialize it to a file - var testContent = "Hello World"; + // Include world twice so we can disinguish between the two rules + var testContent = "Hello World World"; var testRule = @"[ { @@ -95,8 +96,8 @@ public void TestParsingJsonOptions() }; var analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); - // We set exit code is num issues so this should be 1, from the 1 rule that isn't ignored - Assert.AreEqual(1, analyzerWithSerialized.Run()); + // We set exit code is num issues so this should be 2, from the two matchs for the rule that isn't ignored + Assert.AreEqual(2, analyzerWithSerialized.Run()); // Create an AnalyzeCommandOptions object that references the path to the file which ignores a specific rule analyzeOpts = new AnalyzeCommandOptions() { @@ -117,8 +118,8 @@ public void TestParsingJsonOptions() PathToOptionsJson = serializedJsonPath }; analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); - // This should be 2, because 2 rules aren't ignored - Assert.AreEqual(2, analyzerWithSerialized.Run()); + // This should be 3, because no rules are ignored + Assert.AreEqual(3, analyzerWithSerialized.Run()); // Try the js which it should find both analyzeOpts = new AnalyzeCommandOptions() { @@ -140,8 +141,8 @@ public void TestParsingJsonOptions() PathToOptionsJson = serializedJsonPath2 }; analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); - // This should be 2, because the globs dont exclude cs files - Assert.AreEqual(2, analyzerWithSerialized.Run()); + // This should be 3, because the globs dont exclude cs files + Assert.AreEqual(3, analyzerWithSerialized.Run()); // set of options to test enumerable parsing analyzeOpts = new AnalyzeCommandOptions() { From 0f4a8b532609e23c5262e2f86182a4cbd52332bc Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:46:04 -0800 Subject: [PATCH 3/7] Add Include Globs option. When specified, only files that match one of the include globs and that don't match one of the exclude globs are scanned. --- .../Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs | 2 +- .../Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs index cb2db7d5..0e1b3ebb 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs @@ -65,7 +65,7 @@ public int Run() IEnumerable fileListing; Extractor extractor = new Extractor(); - ExtractorOptions extractorOpts = new ExtractorOptions() { ExtractSelfOnFail = false, DenyFilters = _opts.Globs }; + ExtractorOptions extractorOpts = new ExtractorOptions() { ExtractSelfOnFail = false, AllowFilters = _opts.IncludeGlobs, DenyFilters = _opts.Globs }; // Analysing a single file if (!Directory.Exists(fullPath)) { diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs index 826da8b4..61b7785e 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs @@ -45,6 +45,9 @@ public record BaseAnalyzeCommandOptions : LogOptions [Option('g', "ignore-globs", HelpText = "Comma-separated Globs for files to skip analyzing", Separator = ',', Default = new[] { "**/.git/**", "**/bin/**" })] public IEnumerable Globs { get; set; } = new[] { "**/.git/**", "**/bin/**" }; + [Option("include-globs", HelpText = "If set, files must match one of these globs to be analyzed", Separator = ',', Default = new string[]{})] + public IEnumerable IncludeGlobs { get; set; } = new string[]{}; + [Option('d', "disable-supression", HelpText = "Disable comment suppressions", Default = false)] public bool DisableSuppression { get; set; } From 383c0ce26b0f7f24dbaaccaaedb48484e46fe4f6 Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:46:33 -0800 Subject: [PATCH 4/7] New test cases for glob options. --- .../Microsoft.DevSkim.Tests/OptionsTests.cs | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) diff --git a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs index f91233e2..046916d1 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs @@ -8,6 +8,214 @@ namespace Microsoft.DevSkim.Tests; [TestClass] public class OptionsTests { + [TestMethod] + public void TestExcludeGlobs() + { + var serializedOptsExcludeGlobs = new SerializedAnalyzeCommandOptions() + { + Severities = new[] { Severity.Critical | Severity.Important }, + ExitCodeIsNumIssues = true, + Globs = new List() {"*.js"} + }; + var testContent = "Hello World"; + var testRule = +@"[ +{ + ""name"": ""Weak/Broken Hash Algorithm"", + ""id"": ""JsonOptionParseTest"", + ""description"": ""A test that finds hello"", + ""tags"": [ + ""Tests.JsonOptionsTest"" + ], + ""severity"": ""critical"", + ""patterns"": [ + { + ""pattern"": ""Hello"", + ""type"": ""regex"", + ""scopes"": [ + ""code"" + ] + } + ] +}]"; + var rulesPath = PathHelper.GetRandomTempFile("json"); + var serializedJsonPath = PathHelper.GetRandomTempFile("json"); + var csharpTestPath = PathHelper.GetRandomTempFile("cs"); + var jsTestPath = PathHelper.GetRandomTempFile("js"); + { + using var serializedJsonStream = File.Create(serializedJsonPath); + JsonSerializer.Serialize(serializedJsonStream, serializedOptsExcludeGlobs, new JsonSerializerOptions() { }); + using var csharpStream = File.Create(csharpTestPath); + JsonSerializer.Serialize(csharpStream, testContent); + using var jsStream = File.Create(jsTestPath); + JsonSerializer.Serialize(jsStream, testContent); + File.WriteAllText(rulesPath, testRule); + } + + // Create an AnalyzeCommandOptions object referencing our serialized options + var analyzeOpts = new AnalyzeCommandOptions() + { + Path = csharpTestPath, + Rules = new[] { rulesPath }, + PathToOptionsJson = serializedJsonPath + }; + + var analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); + // We set exit code is num issues so this should be 1, as csharp files aren't ignored + Assert.AreEqual(1, analyzerWithSerialized.Run()); + + // Create an AnalyzeCommandOptions object referencing our serialized options + analyzeOpts = new AnalyzeCommandOptions() + { + Path = jsTestPath, + Rules = new[] { rulesPath }, + PathToOptionsJson = serializedJsonPath + }; + + analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); + // We set exit code is num issues so this should be 0, as js files are ignored + Assert.AreEqual(0, analyzerWithSerialized.Run()); + } + + [TestMethod] + public void TestIncludeGlobs() + { + var serializedOptsExcludeGlobs = new SerializedAnalyzeCommandOptions() + { + Severities = new[] { Severity.Critical | Severity.Important }, + ExitCodeIsNumIssues = true, + IncludeGlobs = new List() {"*.js"} + }; + var testContent = "Hello World"; + var testRule = +@"[ +{ + ""name"": ""Weak/Broken Hash Algorithm"", + ""id"": ""JsonOptionParseTest"", + ""description"": ""A test that finds hello"", + ""tags"": [ + ""Tests.JsonOptionsTest"" + ], + ""severity"": ""critical"", + ""patterns"": [ + { + ""pattern"": ""Hello"", + ""type"": ""regex"", + ""scopes"": [ + ""code"" + ] + } + ] +}]"; + var rulesPath = PathHelper.GetRandomTempFile("json"); + var serializedJsonPath = PathHelper.GetRandomTempFile("json"); + var csharpTestPath = PathHelper.GetRandomTempFile("cs"); + var jsTestPath = PathHelper.GetRandomTempFile("js"); + { + using var serializedJsonStream = File.Create(serializedJsonPath); + JsonSerializer.Serialize(serializedJsonStream, serializedOptsExcludeGlobs, new JsonSerializerOptions() { }); + using var csharpStream = File.Create(csharpTestPath); + JsonSerializer.Serialize(csharpStream, testContent); + using var jsStream = File.Create(jsTestPath); + JsonSerializer.Serialize(jsStream, testContent); + File.WriteAllText(rulesPath, testRule); + } + + // Create an AnalyzeCommandOptions object referencing our serialized options + var analyzeOpts = new AnalyzeCommandOptions() + { + Path = csharpTestPath, + Rules = new[] { rulesPath }, + PathToOptionsJson = serializedJsonPath + }; + + var analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); + // We set exit code is num issues so this should be 0, as csharp are implicitly ignored + Assert.AreEqual(0, analyzerWithSerialized.Run()); + + // Create an AnalyzeCommandOptions object referencing our serialized options + analyzeOpts = new AnalyzeCommandOptions() + { + Path = jsTestPath, + Rules = new[] { rulesPath }, + PathToOptionsJson = serializedJsonPath + }; + + analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); + // We set exit code is num issues so this should be 1, as js files are included + Assert.AreEqual(1, analyzerWithSerialized.Run()); + } + + [TestMethod] + public void TestIncludeAndExcludeGlobs() + { + var serializedOptsExcludeGlobs = new SerializedAnalyzeCommandOptions() + { + Severities = new[] { Severity.Critical | Severity.Important }, + ExitCodeIsNumIssues = true, + IncludeGlobs = new List() {"*.js"}, + Globs = new List() {"*hello.js"} + }; + var testContent = "Hello World"; + var testRule = +@"[ +{ + ""name"": ""Weak/Broken Hash Algorithm"", + ""id"": ""JsonOptionParseTest"", + ""description"": ""A test that finds hello"", + ""tags"": [ + ""Tests.JsonOptionsTest"" + ], + ""severity"": ""critical"", + ""patterns"": [ + { + ""pattern"": ""Hello"", + ""type"": ""regex"", + ""scopes"": [ + ""code"" + ] + } + ] +}]"; + var rulesPath = PathHelper.GetRandomTempFile("json"); + var serializedJsonPath = PathHelper.GetRandomTempFile("json"); + var helloJsTestPath = PathHelper.GetRandomTempFile("hello.js"); + var jsTestPath = PathHelper.GetRandomTempFile("js"); + { + using var serializedJsonStream = File.Create(serializedJsonPath); + JsonSerializer.Serialize(serializedJsonStream, serializedOptsExcludeGlobs, new JsonSerializerOptions() { }); + using var helloJsStream = File.Create(helloJsTestPath); + JsonSerializer.Serialize(helloJsStream, testContent); + using var jsStream = File.Create(jsTestPath); + JsonSerializer.Serialize(jsStream, testContent); + File.WriteAllText(rulesPath, testRule); + } + + // Create an AnalyzeCommandOptions object referencing our serialized options + var analyzeOpts = new AnalyzeCommandOptions() + { + Path = helloJsTestPath, + Rules = new[] { rulesPath }, + PathToOptionsJson = serializedJsonPath + }; + + var analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); + // We set exit code is num issues so this should be 0, as hello.js files are ignored + Assert.AreEqual(0, analyzerWithSerialized.Run()); + + // Create an AnalyzeCommandOptions object referencing our serialized options + analyzeOpts = new AnalyzeCommandOptions() + { + Path = jsTestPath, + Rules = new[] { rulesPath }, + PathToOptionsJson = serializedJsonPath + }; + + analyzerWithSerialized = new AnalyzeCommand(analyzeOpts); + // We set exit code is num issues so this should be 1, as regular js files are included + Assert.AreEqual(1, analyzerWithSerialized.Run()); + } + [TestMethod] public void TestParsingJsonOptions() { From 559ae567628f8048ddf34b3d1a41d58ca4fc960e Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:45:46 -0800 Subject: [PATCH 5/7] Rename glob options to reflect that there are two glob arguments. --- .../Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs | 2 +- .../Options/BaseAnalyzeCommandOptions.cs | 4 ++-- DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs index 0e1b3ebb..a550eb43 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs @@ -65,7 +65,7 @@ public int Run() IEnumerable fileListing; Extractor extractor = new Extractor(); - ExtractorOptions extractorOpts = new ExtractorOptions() { ExtractSelfOnFail = false, AllowFilters = _opts.IncludeGlobs, DenyFilters = _opts.Globs }; + ExtractorOptions extractorOpts = new ExtractorOptions() { ExtractSelfOnFail = false, AllowFilters = _opts.AllowGlobs, DenyFilters = _opts.DenyGlobs }; // Analysing a single file if (!Directory.Exists(fullPath)) { diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs index 61b7785e..f57e0ecd 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs @@ -43,10 +43,10 @@ public record BaseAnalyzeCommandOptions : LogOptions public IEnumerable Confidences { get; set; } = new[] { Confidence.High, Confidence.Medium }; [Option('g', "ignore-globs", HelpText = "Comma-separated Globs for files to skip analyzing", Separator = ',', Default = new[] { "**/.git/**", "**/bin/**" })] - public IEnumerable Globs { get; set; } = new[] { "**/.git/**", "**/bin/**" }; + public IEnumerable DenyGlobs { get; set; } = new[] { "**/.git/**", "**/bin/**" }; [Option("include-globs", HelpText = "If set, files must match one of these globs to be analyzed", Separator = ',', Default = new string[]{})] - public IEnumerable IncludeGlobs { get; set; } = new string[]{}; + public IEnumerable AllowGlobs { get; set; } = new string[]{}; [Option('d', "disable-supression", HelpText = "Disable comment suppressions", Default = false)] public bool DisableSuppression { get; set; } diff --git a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs index 046916d1..49f23ad6 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs @@ -15,7 +15,7 @@ public void TestExcludeGlobs() { Severities = new[] { Severity.Critical | Severity.Important }, ExitCodeIsNumIssues = true, - Globs = new List() {"*.js"} + DenyGlobs = new List() {"*.js"} }; var testContent = "Hello World"; var testRule = @@ -84,7 +84,7 @@ public void TestIncludeGlobs() { Severities = new[] { Severity.Critical | Severity.Important }, ExitCodeIsNumIssues = true, - IncludeGlobs = new List() {"*.js"} + AllowGlobs = new List() {"*.js"} }; var testContent = "Hello World"; var testRule = @@ -153,8 +153,8 @@ public void TestIncludeAndExcludeGlobs() { Severities = new[] { Severity.Critical | Severity.Important }, ExitCodeIsNumIssues = true, - IncludeGlobs = new List() {"*.js"}, - Globs = new List() {"*hello.js"} + AllowGlobs = new List() {"*.js"}, + DenyGlobs = new List() {"*hello.js"} }; var testContent = "Hello World"; var testRule = @@ -234,7 +234,7 @@ public void TestParsingJsonOptions() { Severities = new[] { Severity.Critical | Severity.Important }, ExitCodeIsNumIssues = true, - Globs = new List() {"*.js"} + DenyGlobs = new List() {"*.js"} }; // Serialize it to a file // Include world twice so we can disinguish between the two rules From 673d70b4192978099fa33735ad8633b8aa45a188 Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:45:51 -0800 Subject: [PATCH 6/7] Update changelog. --- Changelog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Changelog.md b/Changelog.md index 4785f9aa..7593903f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.50] - 2024-12-05 +## Fix +Fixes #664 handling of options from IgnoreRuleMap when using OptionsJson + +## New Functionality +Adds `include-globs` argument to require all scanned files match a specific glob pattern #663. + ## [1.0.49] - 2024-12-03 ## Rules Fixed false positives and false negatives in outdated/banned SSL/TLS protocols. #649 From fcd0292ae8db3893175031044cd8a95d8a2df679 Mon Sep 17 00:00:00 2001 From: Gabe Stocco <98900+gfs@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:07:09 -0800 Subject: [PATCH 7/7] Rename DenyGlobs back to original Globs to avoid breaking change when using options-json argument. --- .../Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs | 2 +- .../Options/BaseAnalyzeCommandOptions.cs | 2 +- DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs index a550eb43..a6fc565f 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Commands/AnalyzeCommand.cs @@ -65,7 +65,7 @@ public int Run() IEnumerable fileListing; Extractor extractor = new Extractor(); - ExtractorOptions extractorOpts = new ExtractorOptions() { ExtractSelfOnFail = false, AllowFilters = _opts.AllowGlobs, DenyFilters = _opts.DenyGlobs }; + ExtractorOptions extractorOpts = new ExtractorOptions() { ExtractSelfOnFail = false, AllowFilters = _opts.AllowGlobs, DenyFilters = _opts.Globs }; // Analysing a single file if (!Directory.Exists(fullPath)) { diff --git a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs index f57e0ecd..167db2a4 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.CLI/Options/BaseAnalyzeCommandOptions.cs @@ -43,7 +43,7 @@ public record BaseAnalyzeCommandOptions : LogOptions public IEnumerable Confidences { get; set; } = new[] { Confidence.High, Confidence.Medium }; [Option('g', "ignore-globs", HelpText = "Comma-separated Globs for files to skip analyzing", Separator = ',', Default = new[] { "**/.git/**", "**/bin/**" })] - public IEnumerable DenyGlobs { get; set; } = new[] { "**/.git/**", "**/bin/**" }; + public IEnumerable Globs { get; set; } = new[] { "**/.git/**", "**/bin/**" }; [Option("include-globs", HelpText = "If set, files must match one of these globs to be analyzed", Separator = ',', Default = new string[]{})] public IEnumerable AllowGlobs { get; set; } = new string[]{}; diff --git a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs index 49f23ad6..97d64032 100644 --- a/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs +++ b/DevSkim-DotNet/Microsoft.DevSkim.Tests/OptionsTests.cs @@ -15,7 +15,7 @@ public void TestExcludeGlobs() { Severities = new[] { Severity.Critical | Severity.Important }, ExitCodeIsNumIssues = true, - DenyGlobs = new List() {"*.js"} + Globs = new List() {"*.js"} }; var testContent = "Hello World"; var testRule = @@ -154,7 +154,7 @@ public void TestIncludeAndExcludeGlobs() Severities = new[] { Severity.Critical | Severity.Important }, ExitCodeIsNumIssues = true, AllowGlobs = new List() {"*.js"}, - DenyGlobs = new List() {"*hello.js"} + Globs = new List() {"*hello.js"} }; var testContent = "Hello World"; var testRule = @@ -234,7 +234,7 @@ public void TestParsingJsonOptions() { Severities = new[] { Severity.Critical | Severity.Important }, ExitCodeIsNumIssues = true, - DenyGlobs = new List() {"*.js"} + Globs = new List() {"*.js"} }; // Serialize it to a file // Include world twice so we can disinguish between the two rules