Skip to content
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

Enable culture analyzer and fix issues #3678

Merged
merged 23 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Fix culture issues on SettingsMigrator
  • Loading branch information
Evangelink committed Jun 30, 2022
commit fe75a456a6da6d4b50ad12d53384d21acc1172bc
10 changes: 5 additions & 5 deletions src/SettingsMigrator/Migrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void Migrate(string oldFilePath, string newFilePath)
{
if (!Path.IsPathRooted(oldFilePath))
{
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage));
Console.WriteLine(CommandLineResources.ValidUsage);
}

if (string.Equals(Path.GetExtension(oldFilePath), TestSettingsExtension, StringComparison.OrdinalIgnoreCase))
Expand All @@ -80,7 +80,7 @@ public void Migrate(string oldFilePath, string newFilePath)
}
else
{
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage));
Console.WriteLine(CommandLineResources.ValidUsage);
}
}

Expand Down Expand Up @@ -124,7 +124,7 @@ private void MigrateRunSettings(string oldRunSettingsPath, string newRunSettings
}
else
{
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.NoEmbeddedSettings));
Console.WriteLine(CommandLineResources.NoEmbeddedSettings);
}
}

Expand Down Expand Up @@ -224,7 +224,7 @@ private TestSettingsNodes ReadTestSettingsNodes(string testSettingsPath)
if (testSettingsNodes.Timeout != null && (testSettingsNodes.Timeout.Attributes[AgentNotRespondingTimeoutAttribute] != null ||
testSettingsNodes.Timeout.Attributes[DeploymentTimeoutAttribute] != null || testSettingsNodes.Timeout.Attributes[ScriptTimeoutAttribute] != null))
{
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.UnsupportedAttributes));
Console.WriteLine(CommandLineResources.UnsupportedAttributes);
}
}

Expand Down Expand Up @@ -289,7 +289,7 @@ private void AddLegacyNodes(TestSettingsNodes testSettingsNodes, string? testTim
var legacyNode = newXmlDoc.DocumentElement.SelectSingleNode(@"/RunSettings/LegacySettings");
if (legacyNode != null)
{
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.IgnoringLegacySettings));
Console.WriteLine(CommandLineResources.IgnoringLegacySettings);
legacyNode.ParentNode.RemoveChild(legacyNode);
}

Expand Down
3 changes: 2 additions & 1 deletion src/SettingsMigrator/PathResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Globalization;
using System.IO;

namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator;
Expand Down Expand Up @@ -29,7 +30,7 @@ public class PathResolver
if (args.Length == 1)
{
var oldFilePath = args[0];
var newFileName = string.Concat(Path.GetFileNameWithoutExtension(oldFilePath), "_", DateTime.Now.ToString("MM-dd-yyyy_hh-mm-ss"), RunSettingsExtension);
var newFileName = string.Concat(Path.GetFileNameWithoutExtension(oldFilePath), "_", DateTime.Now.ToString("MM-dd-yyyy_hh-mm-ss", CultureInfo.CurrentCulture), RunSettingsExtension);
newFilePath = Path.Combine(Path.GetDirectoryName(oldFilePath), newFileName);
}
else if (args.Length == 2)
Expand Down
3 changes: 1 addition & 2 deletions src/SettingsMigrator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Globalization;

using SettingsMigrator;

Expand Down Expand Up @@ -33,7 +32,7 @@ public static int Main(string[] args)
}
else
{
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.ValidUsage));
Console.WriteLine(CommandLineResources.ValidUsage);
return 1;
}

Expand Down