Skip to content

Commit 2c8e261

Browse files
committed
Refactor to use command data file directory instead of settings directory in AvoidOverwritingBuiltInCmdlets and UseCompatibleCmdlets rules
1 parent f572b2a commit 2c8e261

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Rules/AvoidOverwritingBuiltInCmdlets.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
9090
}
9191

9292
var psVerList = PowerShellVersion;
93-
string settingsPath = Settings.GetShippedSettingsDirectory();
93+
string commandDataFilesPath = Settings.GetShippedCommandDataFileDirectory();
9494

9595
foreach (string reference in psVerList)
9696
{
97-
if (settingsPath == null || !ContainsReferenceFile(settingsPath, reference))
97+
if (commandDataFilesPath == null || !ContainsReferenceFile(commandDataFilesPath, reference))
9898
{
9999
throw new ArgumentException(nameof(PowerShellVersion));
100100
}
101101
}
102102

103-
ProcessDirectory(settingsPath, psVerList);
103+
ProcessDirectory(commandDataFilesPath, psVerList);
104104

105105
if (_cmdletMap.Keys.Count != psVerList.Count())
106106
{

Rules/UseCompatibleCmdlets.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private void SetupCmdletsDictionary()
306306
return;
307307
}
308308

309-
string settingsPath = Settings.GetShippedSettingsDirectory();
309+
string commandDataFilesPath = Settings.GetShippedCommandDataFileDirectory();
310310
#if DEBUG
311311
object modeObject;
312312
if (ruleArgs.TryGetValue("mode", out modeObject))
@@ -317,7 +317,7 @@ private void SetupCmdletsDictionary()
317317
switch (mode)
318318
{
319319
case "offline":
320-
settingsPath = GetStringArgFromListStringArg(ruleArgs["uri"]);
320+
commandDataFilesPath = GetStringArgFromListStringArg(ruleArgs["uri"]);
321321
break;
322322

323323
case "online": // not implemented yet.
@@ -328,8 +328,8 @@ private void SetupCmdletsDictionary()
328328

329329
}
330330
#endif
331-
if (settingsPath == null
332-
|| !ContainsReferenceFile(settingsPath))
331+
if (commandDataFilesPath == null
332+
|| !ContainsReferenceFile(commandDataFilesPath))
333333
{
334334
return;
335335
}
@@ -348,7 +348,7 @@ private void SetupCmdletsDictionary()
348348
}
349349

350350
ProcessDirectory(
351-
settingsPath,
351+
commandDataFilesPath,
352352
extentedCompatibilityList);
353353
if (psCmdletMap.Keys.Count != extentedCompatibilityList.Count())
354354
{

0 commit comments

Comments
 (0)