Skip to content

Commit 39513bb

Browse files
authored
Remove parenthesis for empty attribute parameters (#20087)
1 parent 885b01c commit 39513bb

File tree

57 files changed

+211
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+211
-211
lines changed

src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public PasswordAuthenticationMechanism Authentication
5454
/// The default is the current user.
5555
/// </summary>
5656
[Parameter(Position = 1, ParameterSetName = CredentialParameterSet)]
57-
[Credential()]
57+
[Credential]
5858
public PSCredential Credential { get; set; }
5959

6060
/// <summary>

src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimSessionOptionCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public string ProxyCertificateThumbprint
299299
/// Ps Credential used by the proxy server when required by the server.
300300
/// </summary>
301301
[Parameter(ParameterSetName = WSManParameterSet)]
302-
[Credential()]
302+
[Credential]
303303
public PSCredential ProxyCredential
304304
{
305305
get

src/Microsoft.PowerShell.Commands.Management/commands/management/ClearRecycleBinCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public string[] DriveLetter
4141
/// <summary>
4242
/// Property that sets force parameter. This will allow to clear the recyclebin.
4343
/// </summary>
44-
[Parameter()]
44+
[Parameter]
4545
public SwitchParameter Force
4646
{
4747
get

src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public sealed class GetEventLogCommand : PSCmdlet
4848
/// <summary>
4949
/// Read eventlog entries from this computer.
5050
/// </summary>
51-
[Parameter()]
52-
[ValidateNotNullOrEmpty()]
51+
[Parameter]
52+
[ValidateNotNullOrEmpty]
5353
[Alias("Cn")]
5454
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
5555
public string[] ComputerName { get; set; } = Array.Empty<string>();
@@ -123,7 +123,7 @@ public string[] UserName
123123
/// gets or sets an array of instanceIds.
124124
/// </summary>
125125
[Parameter(Position = 1, ParameterSetName = "LogName")]
126-
[ValidateNotNullOrEmpty()]
126+
[ValidateNotNullOrEmpty]
127127
[ValidateRangeAttribute((long)0, long.MaxValue)]
128128
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
129129
public long[] InstanceId
@@ -144,7 +144,7 @@ public long[] InstanceId
144144
/// gets or sets an array of indexes.
145145
/// </summary>
146146
[Parameter(ParameterSetName = "LogName")]
147-
[ValidateNotNullOrEmpty()]
147+
[ValidateNotNullOrEmpty]
148148
[ValidateRangeAttribute((int)1, int.MaxValue)]
149149
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
150150
public int[] Index
@@ -165,7 +165,7 @@ public int[] Index
165165
/// gets or sets an array of EntryTypes.
166166
/// </summary>
167167
[Parameter(ParameterSetName = "LogName")]
168-
[ValidateNotNullOrEmpty()]
168+
[ValidateNotNullOrEmpty]
169169
[ValidateSetAttribute(new string[] { "Error", "Information", "FailureAudit", "SuccessAudit", "Warning" })]
170170
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
171171
[Alias("ET")]
@@ -186,7 +186,7 @@ public string[] EntryType
186186
/// Get or sets an array of Source.
187187
/// </summary>
188188
[Parameter(ParameterSetName = "LogName")]
189-
[ValidateNotNullOrEmpty()]
189+
[ValidateNotNullOrEmpty]
190190
[Alias("ABO")]
191191
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
192192
public string[] Source
@@ -207,7 +207,7 @@ public string[] Source
207207
/// Get or Set Message string to searched in EventLog.
208208
/// </summary>
209209
[Parameter(ParameterSetName = "LogName")]
210-
[ValidateNotNullOrEmpty()]
210+
[ValidateNotNullOrEmpty]
211211
[Alias("MSG")]
212212
public string Message
213213
{

src/Microsoft.PowerShell.Commands.Management/commands/management/GetWMIObjectCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class GetWmiObjectCommand : WmiBaseCmdlet
2626
[Alias("ClassName")]
2727
[Parameter(Position = 0, Mandatory = true, ParameterSetName = "query")]
2828
[Parameter(Position = 1, ParameterSetName = "list")]
29-
[ValidateNotNullOrEmpty()]
29+
[ValidateNotNullOrEmpty]
3030
public string Class { get; set; }
3131

3232
/// <summary>
@@ -39,7 +39,7 @@ public class GetWmiObjectCommand : WmiBaseCmdlet
3939
/// The WMI properties to retrieve.
4040
/// </summary>
4141
[Parameter(Position = 1, ParameterSetName = "query")]
42-
[ValidateNotNullOrEmpty()]
42+
[ValidateNotNullOrEmpty]
4343
public string[] Property
4444
{
4545
get { return (string[])_property.Clone(); }

src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public class CoreCommandWithCredentialsBase : CoreCommandBase
283283
/// Gets or sets the credential parameter.
284284
/// </summary>
285285
[Parameter(ValueFromPipelineByPropertyName = true)]
286-
[Credential()]
286+
[Credential]
287287
public PSCredential Credential { get; set; }
288288

289289
#endregion Parameters
@@ -4128,7 +4128,7 @@ public class GetPSProviderCommand : CoreCommandBase
41284128
/// Gets or sets the provider that will be removed.
41294129
/// </summary>
41304130
[Parameter(Position = 0, ValueFromPipelineByPropertyName = true)]
4131-
[ValidateNotNullOrEmpty()]
4131+
[ValidateNotNullOrEmpty]
41324132
public string[] PSProvider
41334133
{
41344134
get => _provider;

src/Microsoft.PowerShell.Commands.Management/commands/management/RegisterWMIEventCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class RegisterWmiEventCommand : ObjectEventRegistrationBase
3333
/// The credential to use.
3434
/// </summary>
3535
[Parameter]
36-
[Credential()]
36+
[Credential]
3737
public PSCredential Credential { get; set; }
3838

3939
/// <summary>

src/Microsoft.PowerShell.Commands.Management/commands/management/StartTransactionCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class StartTransactionCommand : PSCmdlet
1818
/// The time, in minutes, before this transaction is rolled back
1919
/// automatically.
2020
/// </summary>
21-
[Parameter()]
21+
[Parameter]
2222
[Alias("TimeoutMins")]
2323
public int Timeout
2424
{
@@ -47,7 +47,7 @@ public int Timeout
4747
/// Gets or sets the flag to determine if this transaction can
4848
/// be committed or rolled back independently of other transactions.
4949
/// </summary>
50-
[Parameter()]
50+
[Parameter]
5151
public SwitchParameter Independent
5252
{
5353
get { return _independent; }
@@ -60,7 +60,7 @@ public SwitchParameter Independent
6060
/// <summary>
6161
/// Gets or sets the rollback preference for this transaction.
6262
/// </summary>
63-
[Parameter()]
63+
[Parameter]
6464
public RollbackSeverity RollbackPreference
6565
{
6666
get { return _rollbackPreference; }

src/Microsoft.PowerShell.Commands.Management/commands/management/WMIHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ public class WmiBaseCmdlet : Cmdlet
11201120
[Parameter(ParameterSetName = "WQLQuery")]
11211121
[Parameter(ParameterSetName = "query")]
11221122
[Parameter(ParameterSetName = "list")]
1123-
[Credential()]
1123+
[Credential]
11241124
public PSCredential Credential { get; set; }
11251125

11261126
/// <summary>

src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddMember.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ public SwitchParameter PassThru
147147
/// The name of the new NoteProperty member.
148148
/// </summary>
149149
[Parameter(Mandatory = true, Position = 0, ParameterSetName = NotePropertySingleMemberSet)]
150-
[ValidateNotePropertyNameAttribute()]
151-
[NotePropertyTransformationAttribute()]
150+
[ValidateNotePropertyNameAttribute]
151+
[NotePropertyTransformationAttribute]
152152
[ValidateNotNullOrEmpty]
153153
public string NotePropertyName
154154
{

0 commit comments

Comments
 (0)