Skip to content

Commit 933c21b

Browse files
Revert some changes.
1 parent 48057f2 commit 933c21b

File tree

3 files changed

+31
-44
lines changed

3 files changed

+31
-44
lines changed

tools/StaticAnalysis/BreakingChangeAnalyzer/BreakingChangeAnalyzer.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public BreakingChangeAnalyzer()
4141
}
4242

4343
/// <summary>
44-
/// Given a set of directory paths containing PowerShell module folders,
44+
/// Given a set of directory paths containing PowerShell module folders,
4545
/// analyze the breaking changes in the modules and report any issues
4646
/// </summary>
4747
/// <param name="cmdletProbingDirs">Set of directory paths containing PowerShell module folders to be checked for breaking changes.</param>
@@ -53,7 +53,7 @@ public void Analyze(IEnumerable<string> cmdletProbingDirs)
5353
/// <summary>
5454
/// Given a set of directory paths containing PowerShell module folders,
5555
/// analyze the breaking changes in the modules and report any issues
56-
///
56+
///
5757
/// Filters can be added to find breaking changes for specific modules
5858
/// </summary>
5959
/// <param name="cmdletProbingDirs">Set of directory paths containing PowerShell module folders to be checked for breaking changes.</param>
@@ -73,7 +73,7 @@ public void Analyze(
7373
cmdletProbingDirs = directoryFilter(cmdletProbingDirs);
7474
}
7575

76-
foreach (var baseDirectory in cmdletProbingDirs.Where(s => !s.Contains("ServiceManagement") &&
76+
foreach (var baseDirectory in cmdletProbingDirs.Where(s => !s.Contains("ServiceManagement") &&
7777
!s.Contains("Stack") && Directory.Exists(Path.GetFullPath(s))))
7878
{
7979
List<string> probingDirectories = new List<string>();
@@ -85,10 +85,6 @@ public void Analyze(
8585
foreach (var directory in probingDirectories)
8686
{
8787
var service = Path.GetFileName(directory);
88-
if (service.ToLower().EndsWith("experiments"))
89-
{
90-
return;
91-
}
9288

9389
var manifestFiles = Directory.EnumerateFiles(directory, "*.psd1").ToList();
9490

@@ -108,8 +104,8 @@ public void Analyze(
108104
var psd1FileName = Path.GetFileName(psd1);
109105

110106
PowerShell powershell = PowerShell.Create();
111-
powershell.AddScript("Import-LocalizedData -BaseDirectory " + parentDirectory +
112-
" -FileName " + psd1FileName +
107+
powershell.AddScript("Import-LocalizedData -BaseDirectory " + parentDirectory +
108+
" -FileName " + psd1FileName +
113109
" -BindingVariable ModuleMetadata; $ModuleMetadata.NestedModules");
114110

115111
var cmdletResult = powershell.Invoke();
@@ -120,17 +116,17 @@ public void Analyze(
120116
foreach (var cmdletFileName in cmdletFiles)
121117
{
122118
var cmdletFileFullPath = Path.Combine(directory, Path.GetFileName(cmdletFileName));
123-
119+
124120
if (File.Exists(cmdletFileFullPath))
125121
{
126122
issueLogger.Decorator.AddDecorator(a => a.AssemblyFileName = cmdletFileFullPath, "AssemblyFileName");
127123
processedHelpFiles.Add(cmdletFileName);
128-
var proxy =
124+
var proxy =
129125
EnvironmentHelpers.CreateProxy<CmdletBreakingChangeLoader>(directory, out _appDomain);
130126
var newModuleMetadata = proxy.GetModuleMetadata(cmdletFileFullPath);
131127

132128
string fileName = cmdletFileName + ".json";
133-
string executingPath =
129+
string executingPath =
134130
Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath);
135131

136132
string filePath = executingPath + "\\SerializedCmdlets\\" + fileName;

tools/StaticAnalysis/HelpAnalyzer/HelpAnalyzer.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ private static bool IsAssemblyFile(string path)
6363
{
6464
result = result && !regex.IsMatch(fileName);
6565
}
66-
67-
return result;
6866
}
6967
/// <summary>
70-
/// Given a set of directory paths containing PowerShell module folders, analyze the help
68+
/// Given a set of directory paths containing PowerShell module folders, analyze the help
7169
/// in the module folders and report any issues
7270
/// </summary>
7371
/// <param name="scopes"></param>
@@ -155,7 +153,7 @@ private void AnalyzeMarkdownHelp(
155153
string savedDirectory)
156154
{
157155
var helpFolder = Directory.EnumerateDirectories(directory, "help").FirstOrDefault();
158-
var service = Path.GetFileName(directory);
156+
var service = Path.GetFileName(directory);
159157
if (helpFolder == null)
160158
{
161159
helpLogger.LogRecord(new HelpIssue()
@@ -197,14 +195,7 @@ private void AnalyzeMarkdownHelp(
197195
" -FileName " + psd1FileName +
198196
" -BindingVariable ModuleMetadata; $ModuleMetadata.NestedModules");
199197
var cmdletResult = powershell.Invoke();
200-
201-
// used for webapp experimental cmdlets. Reason: no nested modules.
202-
if (cmdletResult == null)
203-
{
204-
return;
205-
}
206-
207-
var cmdletFiles = cmdletResult.Where(i => i != null && !string.IsNullOrWhiteSpace(i.ToString()) && i.ToString().Length > 2).Select(c => c.ToString().Substring(2));
198+
var cmdletFiles = cmdletResult.Select(c => c.ToString().Substring(2));
208199
if (cmdletFiles.Any())
209200
{
210201
List<CmdletHelpMetadata> allCmdlets = new List<CmdletHelpMetadata>();
@@ -235,7 +226,7 @@ private void AnalyzeMarkdownHelp(
235226
}
236227
}
237228

238-
private void ValidateHelpRecords(IList<CmdletHelpMetadata> cmdlets, IList<string> helpRecords,
229+
private void ValidateHelpRecords(IList<CmdletHelpMetadata> cmdlets, IList<string> helpRecords,
239230
ReportLogger<HelpIssue> helpLogger)
240231
{
241232
foreach (var cmdlet in cmdlets)
@@ -247,7 +238,7 @@ private void ValidateHelpRecords(IList<CmdletHelpMetadata> cmdlets, IList<string
247238
Target = cmdlet.ClassName,
248239
Severity = 1,
249240
ProblemId = MissingHelp,
250-
Description = string.Format("Help missing for cmdlet {0} implemented by class {1}",
241+
Description = string.Format("Help missing for cmdlet {0} implemented by class {1}",
251242
cmdlet.CmdletName, cmdlet.ClassName),
252243
Remediation = string.Format("Add Help record for cmdlet {0} to help file.", cmdlet.CmdletName)
253244
});

tools/UpdateModules.ps1

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function Create-ModulePsm1
5050
elseif ($mod["RequiredVersion"])
5151
{
5252
$importedModules += "Import-Module " + $mod["ModuleName"] + " -RequiredVersion " + $mod["RequiredVersion"] + "`r`n"
53-
}
53+
}
5454
}
5555
}
5656

@@ -69,7 +69,7 @@ function Create-ModulePsm1
6969

7070
$contructedCommands = Find-DefaultResourceGroupCmdlets -AddDefaultParameters $AddDefaultParameters -ModuleMetadata $ModuleMetadata -ModulePath $ModulePath
7171
$template = $template -replace "%COMMANDS%", $contructedCommands
72-
72+
7373
Write-Host "Writing psm1 manifest to $templateOutputPath"
7474
$template | Out-File -FilePath $templateOutputPath -Force
7575
$file = Get-Item -Path $templateOutputPath
@@ -86,7 +86,7 @@ function Find-DefaultResourceGroupCmdlets
8686
)
8787
PROCESS
8888
{
89-
if ($AddDefaultParameters)
89+
if ($AddDefaultParameters)
9090
{
9191
$nestedModules = $ModuleMetadata.NestedModules
9292
$AllCmdlets = @()
@@ -96,9 +96,9 @@ function Find-DefaultResourceGroupCmdlets
9696
$dllCmdlets = $Assembly.GetTypes() | Where-Object {$_.CustomAttributes.AttributeType.Name -contains "CmdletAttribute"}
9797
$AllCmdlets += $dllCmdlets
9898
}
99-
99+
100100
$FilteredCommands = $AllCmdlets | Where-Object {Test-CmdletRequiredParameter -Cmdlet $_ -Parameter "ResourceGroupName"}
101-
101+
102102
if ($FilteredCommands.Length -eq 0) {
103103
$contructedCommands = "@()"
104104
}
@@ -109,7 +109,7 @@ function Find-DefaultResourceGroupCmdlets
109109
}
110110
$contructedCommands = $contructedCommands -replace ".$",")"
111111
}
112-
112+
113113
return $contructedCommands
114114
}
115115

@@ -144,7 +144,7 @@ function Test-CmdletRequiredParameter
144144
return $true
145145
}
146146
}
147-
147+
148148
return $false
149149
}
150150
}
@@ -180,10 +180,10 @@ if ([string]::IsNullOrEmpty($buildConfig))
180180
if ([string]::IsNullOrEmpty($scope))
181181
{
182182
Write-Verbose "Default scope to all"
183-
$scope = 'All'
183+
$scope = 'All'
184184
}
185185

186-
Write-Host "Updating $scope package(and its dependencies)"
186+
Write-Host "Updating $scope package(and its dependencies)"
187187

188188
$packageFolder = "$PSScriptRoot\..\src\Package"
189189

@@ -209,21 +209,21 @@ if (($scope -eq 'All') -or ($scope -eq 'AzureStorage')) {
209209
# Publish AzureStorage module
210210
Write-Host "Updating AzureStorage module from $modulePath"
211211
Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation $false
212-
}
212+
}
213213

214214
if (($scope -eq 'All') -or ($scope -eq 'ServiceManagement')) {
215215
$modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure"
216216
# Publish Azure module
217217
Write-Host "Updating ServiceManagement(aka Azure) module from $modulePath"
218218
Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation $false
219-
}
219+
}
220220

221221
$resourceManagerModules = Get-ChildItem -Path $resourceManagerRootFolder -Directory
222-
if ($scope -eq 'All') {
222+
if ($scope -eq 'All') {
223223
foreach ($module in $resourceManagerModules) {
224-
# filter out AzureRM.Profile which always gets published first
225-
# And "Azure.Storage" which is built out as test dependencies
226-
if (($module.Name -ne "AzureRM.Profile") -and ($module.Name -ne "Azure.Storage") -and (!$module.Name.Contains("Experiment"))) {
224+
# filter out AzureRM.Profile which always gets published first
225+
# And "Azure.Storage" which is built out as test dependencies
226+
if (($module.Name -ne "AzureRM.Profile") -and ($module.Name -ne "Azure.Storage")) {
227227
$modulePath = $module.FullName
228228
Write-Host "Updating $module module from $modulePath"
229229
Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation $true
@@ -235,14 +235,14 @@ if ($scope -eq 'All') {
235235
if (Test-Path $modulePath) {
236236
Write-Host "Updating $scope module from $modulePath"
237237
Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation $false
238-
Write-Host "Updated $scope module"
238+
Write-Host "Updated $scope module"
239239
} else {
240240
Write-Error "Can not find module with name $scope to publish"
241241
}
242242
}
243243

244244
if (($scope -eq 'All') -or ($scope -eq 'AzureRM')) {
245-
# Update AzureRM module
245+
# Update AzureRM module
246246
if ($Profile -eq "Stack")
247247
{
248248
$modulePath = "$PSScriptRoot\..\src\StackAdmin\AzureRM"
@@ -260,5 +260,5 @@ if (($scope -eq 'All') -or ($scope -eq 'AzureRM')) {
260260
Create-ModulePsm1 -ModulePath $modulePath -TemplatePath $templateLocation $false
261261
Write-Host "Updated Azure module"
262262
}
263-
}
263+
}
264264

0 commit comments

Comments
 (0)