Skip to content

Commit 8f3a434

Browse files
authored
Move ModuleFilter from VersionController to Tools.Common (#12122)
* Move ModuleFilter from VersionController to Tools.Common。 * Fix the places that use ModuleFilter before. * Fix "Stack" problem use ModuleFilter in StaticAnalyzer.
1 parent af0071b commit 8f3a434

File tree

10 files changed

+13
-10
lines changed

10 files changed

+13
-10
lines changed

tools/StaticAnalysis/BreakingChangeAnalyzer/BreakingChangeAnalyzer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using Tools.Common.Loaders;
3131
using Tools.Common.Loggers;
3232
using Tools.Common.Models;
33+
using Tools.Common.Utilities;
3334

3435
namespace StaticAnalysis.BreakingChangeAnalyzer
3536
{
@@ -97,7 +98,7 @@ public void Analyze(
9798
}
9899

99100
foreach (var baseDirectory in cmdletProbingDirs.Where(s => !s.Contains("ServiceManagement") &&
100-
!s.Contains("Stack") && Directory.Exists(Path.GetFullPath(s))))
101+
!ModuleFilter.IsAzureStackModule(s) && Directory.Exists(Path.GetFullPath(s))))
101102
{
102103
var probingDirectories = new List<string> {baseDirectory};
103104

tools/StaticAnalysis/BreakingChangeAttributesAnalyzer/BreakingChangeAttributesAnalyzer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
using Tools.Common.Helpers;
2929
using Tools.Common.Issues;
3030
using Tools.Common.Loggers;
31+
using Tools.Common.Utilities;
3132

3233
namespace StaticAnalysis.BreakingChangeAttributesAnalyzer
3334
{
@@ -104,7 +105,7 @@ public void Analyze(IEnumerable<string> cmdletProbingDirs, Func<IEnumerable<stri
104105
try
105106
{
106107
foreach (var baseDirectory in cmdletProbingDirs.Where(s => !s.Contains("ServiceManagement") &&
107-
!s.Contains("Stack") && Directory.Exists(Path.GetFullPath(s))))
108+
!ModuleFilter.IsAzureStackModule(s) && Directory.Exists(Path.GetFullPath(s))))
108109
{
109110
var probingDirectories = new List<string> {baseDirectory};
110111

tools/StaticAnalysis/SignatureVerifier/SignatureVerifier.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using Tools.Common.Loaders;
2424
using Tools.Common.Loggers;
2525
using Tools.Common.Models;
26+
using Tools.Common.Utilities;
2627

2728
namespace StaticAnalysis.SignatureVerifier
2829
{
@@ -74,7 +75,7 @@ public void Analyze(IEnumerable<string> cmdletProbingDirs,
7475
}
7576

7677
foreach (var baseDirectory in cmdletProbingDirs.Where(s => !s.Contains("ServiceManagement") &&
77-
!s.Contains("Stack") && Directory.Exists(Path.GetFullPath(s))))
78+
!ModuleFilter.IsAzureStackModule(s) && Directory.Exists(Path.GetFullPath(s))))
7879
{
7980
//Add current directory for probing
8081
probingDirectories.Add(baseDirectory);

tools/Tools.Common/Tools.Common.Netcore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
<ItemGroup>
2828
<Content Include="SerializedCmdlets\*.json" CopyToOutputDirectory="PreserveNewest" />
29+
<Content Include="WhiteList.csv" CopyToOutputDirectory="PreserveNewest" />
2930
</ItemGroup>
3031

3132
</Project>

tools/VersionController/Utilities/ModuleFilter.cs renamed to tools/Tools.Common/Utilities/ModuleFilter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
using System.Linq;
44
using System.Reflection;
55

6-
namespace VersionController.Utilities
6+
namespace Tools.Common.Utilities
77
{
8-
class ModuleFilter
8+
public class ModuleFilter
99
{
1010
public static bool IsAzureStackModule(String fileName)
1111
{
@@ -22,7 +22,7 @@ public static bool IsAzureStackModule(String fileName)
2222
var lines = File.ReadAllLines(whiteListFile).Skip(1).Where(c => !string.IsNullOrEmpty(c));
2323
foreach (var line in lines)
2424
{
25-
var cols = line.Split(",").Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
25+
var cols = line.Split(',').Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
2626
.Select(c => c.EndsWith("\"") ? c.Substring(0, c.Length - 1) : c)
2727
.Select(c => c.Trim()).ToArray();
2828
if (cols.Length >= 1)

tools/VersionController/Models/VersionBumper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Reflection;
88
using System.Text.RegularExpressions;
99
using Tools.Common.Models;
10-
using VersionController.Utilities;
10+
using Tools.Common.Utilities;
1111

1212
namespace VersionController.Models
1313
{

tools/VersionController/Models/VersionFileHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using System.IO;
33
using System.Linq;
4-
using VersionController.Utilities;
4+
using Tools.Common.Utilities;
55

66
namespace VersionController.Models
77
{

tools/VersionController/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using System.Reflection;
88
using Tools.Common.Models;
99
using VersionController.Models;
10-
using VersionController.Utilities;
10+
using Tools.Common.Utilities;
1111

1212
namespace VersionController
1313
{

tools/VersionController/VersionController.Netcore.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848

4949
<ItemGroup>
5050
<Content Include="MinimalVersion.csv" CopyToOutputDirectory="PreserveNewest" />
51-
<Content Include="WhiteList.csv" CopyToOutputDirectory="PreserveNewest" />
5251
</ItemGroup>
5352

5453
</Project>

0 commit comments

Comments
 (0)