Skip to content

Commit 966fe6f

Browse files
committed
Fix errors in breaking change tool
1 parent ccb7817 commit 966fe6f

File tree

6 files changed

+9
-1023
lines changed

6 files changed

+9
-1023
lines changed

tools/StaticAnalysis/BreakingChangeAnalyzer/CmdletBreakingChangeLoader.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ public ModuleMetadata GetModuleMetadata(string assemblyPath)
156156

157157
foreach (var parameter in globalParameters)
158158
{
159-
parameterSet.Parameters.Add(parameter);
159+
var param = parameterSet.Parameters.FirstOrDefault(p => p.ParameterMetadata.Name.Equals(parameter.ParameterMetadata.Name));
160+
if (param == null)
161+
{
162+
parameterSet.Parameters.Add(parameter);
163+
}
160164
}
161165
}
162166

tools/StaticAnalysis/BreakingChangeAnalyzer/CmdletMetadataHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ private void CheckForChangedOutputType(
220220
// Add each output in the new metadata to the dictionary
221221
foreach (var newOutput in newCmdlet.OutputTypes)
222222
{
223-
if (!outputDictionary.ContainsKey(newOutput.Type.Name))
223+
if (!outputDictionary.ContainsKey(newOutput.Type.AssemblyQualifiedName))
224224
{
225-
outputDictionary.Add(newOutput.Type.Name, newOutput.Type);
225+
outputDictionary.Add(newOutput.Type.AssemblyQualifiedName, newOutput.Type);
226226
}
227227
}
228228

@@ -232,9 +232,9 @@ private void CheckForChangedOutputType(
232232
{
233233
// If the output can be found, use the TypeMetadataHelper to
234234
// check the type for any breaking changes
235-
if (outputDictionary.ContainsKey(oldOutput.Type.Name))
235+
if (outputDictionary.ContainsKey(oldOutput.Type.AssemblyQualifiedName))
236236
{
237-
var newOutputType = outputDictionary[oldOutput.Type.Name];
237+
var newOutputType = outputDictionary[oldOutput.Type.AssemblyQualifiedName];
238238

239239
_typeMetadataHelper.CheckOutputType(oldCmdlet, oldOutput.Type, newOutputType, issueLogger);
240240
}

0 commit comments

Comments
 (0)