mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix SA1122: Use string.Empty for empty strings (#14218)
https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1122.md
This commit is contained in:
+1
-1
@@ -1162,7 +1162,7 @@ dotnet_diagnostic.SA1120.severity = none
|
||||
dotnet_diagnostic.SA1121.severity = none
|
||||
|
||||
# SA1122: Use string.Empty for empty strings
|
||||
dotnet_diagnostic.SA1122.severity = none
|
||||
dotnet_diagnostic.SA1122.severity = warning
|
||||
|
||||
# SA1123: Do not place regions within elements
|
||||
dotnet_diagnostic.SA1123.severity = none
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// Run a command.
|
||||
/// </summary>
|
||||
protected void RunCommand(String command, String args) {
|
||||
String cmd = "";
|
||||
String cmd = string.Empty;
|
||||
|
||||
_process = new Process()
|
||||
{
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
catch (ArgumentException)
|
||||
{
|
||||
WriteNonTerminatingError(
|
||||
"",
|
||||
string.Empty,
|
||||
processId,
|
||||
processId,
|
||||
null,
|
||||
|
||||
@@ -1284,7 +1284,7 @@ namespace Microsoft.WSMan.Management
|
||||
{
|
||||
if (!Force)
|
||||
{
|
||||
string query = "";
|
||||
string query = string.Empty;
|
||||
string caption = helper.GetResourceMsgFromResourcetext("SetItemGeneralSecurityCaption");
|
||||
if (ChildName.Equals("TrustedHosts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace System.Management.Automation
|
||||
|
||||
if (CommandName == null || CommandName.Length == 0)
|
||||
{
|
||||
CommandName = new[] { "" };
|
||||
CommandName = new[] { string.Empty };
|
||||
}
|
||||
|
||||
for (int i = 0; i < CommandName.Length; i++)
|
||||
|
||||
@@ -2345,7 +2345,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
key: "FileList",
|
||||
manifestProcessingFlags,
|
||||
moduleBase,
|
||||
extension: "",
|
||||
extension: string.Empty,
|
||||
// Don't check file existence - don't want to change current behavior without feature team discussion.
|
||||
verifyFilesExist: false,
|
||||
out List<string> fileList))
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace System.Management.Automation.Runspaces
|
||||
}
|
||||
|
||||
default:
|
||||
Debug.Fail("");
|
||||
Debug.Fail(string.Empty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2236,7 +2236,7 @@ namespace System.Management.Automation
|
||||
}
|
||||
else
|
||||
{
|
||||
module = new string[] { "" };
|
||||
module = new string[] { string.Empty };
|
||||
}
|
||||
|
||||
ModuleSpecification[] fullyQualifiedName = null;
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace Microsoft.PowerShell
|
||||
//
|
||||
// Since command_name is ignored and we can't use null (it's the terminator)
|
||||
// we use empty string
|
||||
execArgs[4] = "";
|
||||
execArgs[4] = string.Empty;
|
||||
|
||||
// Add the arguments passed to pwsh on the end.
|
||||
args.CopyTo(execArgs, 5);
|
||||
|
||||
Reference in New Issue
Block a user