Skip to content

Move ModuleFilter from VersionController to Tools.Common #12122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using Tools.Common.Loaders;
using Tools.Common.Loggers;
using Tools.Common.Models;
using Tools.Common.Utilities;

namespace StaticAnalysis.BreakingChangeAnalyzer
{
Expand Down Expand Up @@ -97,7 +98,7 @@ public void Analyze(
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using Tools.Common.Helpers;
using Tools.Common.Issues;
using Tools.Common.Loggers;
using Tools.Common.Utilities;

namespace StaticAnalysis.BreakingChangeAttributesAnalyzer
{
Expand Down Expand Up @@ -104,7 +105,7 @@ public void Analyze(IEnumerable<string> cmdletProbingDirs, Func<IEnumerable<stri
try
{
foreach (var baseDirectory in cmdletProbingDirs.Where(s => !s.Contains("ServiceManagement") &&
!s.Contains("Stack") && Directory.Exists(Path.GetFullPath(s))))
!ModuleFilter.IsAzureStackModule(s) && Directory.Exists(Path.GetFullPath(s))))
{
var probingDirectories = new List<string> {baseDirectory};

Expand Down
3 changes: 2 additions & 1 deletion tools/StaticAnalysis/SignatureVerifier/SignatureVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Tools.Common.Loaders;
using Tools.Common.Loggers;
using Tools.Common.Models;
using Tools.Common.Utilities;

namespace StaticAnalysis.SignatureVerifier
{
Expand Down Expand Up @@ -74,7 +75,7 @@ public void Analyze(IEnumerable<string> cmdletProbingDirs,
}

foreach (var baseDirectory in cmdletProbingDirs.Where(s => !s.Contains("ServiceManagement") &&
!s.Contains("Stack") && Directory.Exists(Path.GetFullPath(s))))
!ModuleFilter.IsAzureStackModule(s) && Directory.Exists(Path.GetFullPath(s))))
{
//Add current directory for probing
probingDirectories.Add(baseDirectory);
Expand Down
1 change: 1 addition & 0 deletions tools/Tools.Common/Tools.Common.Netcore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<ItemGroup>
<Content Include="SerializedCmdlets\*.json" CopyToOutputDirectory="PreserveNewest" />
<Content Include="WhiteList.csv" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using System.Linq;
using System.Reflection;

namespace VersionController.Utilities
namespace Tools.Common.Utilities
{
class ModuleFilter
public class ModuleFilter
{
public static bool IsAzureStackModule(String fileName)
{
Expand All @@ -22,7 +22,7 @@ public static bool IsAzureStackModule(String fileName)
var lines = File.ReadAllLines(whiteListFile).Skip(1).Where(c => !string.IsNullOrEmpty(c));
foreach (var line in lines)
{
var cols = line.Split(",").Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
var cols = line.Split(',').Select(c => c.StartsWith("\"") ? c.Substring(1) : c)
.Select(c => c.EndsWith("\"") ? c.Substring(0, c.Length - 1) : c)
.Select(c => c.Trim()).ToArray();
if (cols.Length >= 1)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tools/VersionController/Models/VersionBumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Reflection;
using System.Text.RegularExpressions;
using Tools.Common.Models;
using VersionController.Utilities;
using Tools.Common.Utilities;

namespace VersionController.Models
{
Expand Down
2 changes: 1 addition & 1 deletion tools/VersionController/Models/VersionFileHelper.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using VersionController.Utilities;
using Tools.Common.Utilities;

namespace VersionController.Models
{
Expand Down
2 changes: 1 addition & 1 deletion tools/VersionController/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Reflection;
using Tools.Common.Models;
using VersionController.Models;
using VersionController.Utilities;
using Tools.Common.Utilities;

namespace VersionController
{
Expand Down
1 change: 0 additions & 1 deletion tools/VersionController/VersionController.Netcore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

<ItemGroup>
<Content Include="MinimalVersion.csv" CopyToOutputDirectory="PreserveNewest" />
<Content Include="WhiteList.csv" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>