Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Force rules

# IDE0044: Add readonly modifier
dotnet_style_readonly_field = true:error
# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = error
# IDE0003: Remove qualification
dotnet_style_qualification_for_method = false:none
# IDE0003: Remove qualification
dotnet_style_qualification_for_field = false:none
# IDE0003: Remove qualification
dotnet_style_qualification_for_property = false:none
# IDE0003: Remove qualification
dotnet_style_qualification_for_event = false:none

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
Expand Down
10 changes: 7 additions & 3 deletions PowerShell.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
# https://github.com/dotnet/project-system/blob/master/docs/opening-with-new-project-system.md#project-type-guids
VisualStudioVersion = 15.0.26730.12
# Visual Studio Version 16
VisualStudioVersion = 16.0.29806.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "powershell-win-core", "src\powershell-win-core\powershell-win-core.csproj", "{8359D422-E0C4-4A0D-94EB-3C9DD16B7932}"
EndProject
Expand Down Expand Up @@ -42,6 +41,11 @@ EndProject
#
# 73EA0BE6-C0C5-4B56-A5AA-DADA4C01D690 - powershell-unix
# Only Linux is valid, all configurations mapped to Linux
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D0361BC1-7403-4662-B918-215480B5CD17}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CodeCoverage|Any CPU = CodeCoverage|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,14 @@ private void Cleanup()
/// <summary>
/// Event to notify ps thread that more action is available.
/// </summary>
private ManualResetEventSlim moreActionEvent;
private readonly ManualResetEventSlim moreActionEvent;

/// <summary>
/// The following is the definition of action queue.
/// The queue holding all actions to be executed in the context of either
/// ProcessRecord or EndProcessing.
/// </summary>
private ConcurrentQueue<CimBaseAction> actionQueue;
private readonly ConcurrentQueue<CimBaseAction> actionQueue;

/// <summary>
/// Lock object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected virtual void Block()
/// <summary>
/// Action completed event.
/// </summary>
private ManualResetEventSlim completeEvent;
private readonly ManualResetEventSlim completeEvent;

/// <summary>
/// Response result.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ internal CimCmdletAliasEntry(string name, string value)
/// </summary>
internal string Name { get { return this._name; } }

private string _name;
private readonly string _name;

/// <summary>
/// The string defining real cmdlet name.
/// </summary>
internal string Value { get { return this._value; } }

private string _value = string.Empty;
private readonly string _value = string.Empty;

/// <summary>
/// The string defining real cmdlet name.
/// </summary>
internal ScopedItemOptions Options { get { return this._options; } }

private ScopedItemOptions _options = ScopedItemOptions.AllScope | ScopedItemOptions.ReadOnly;
private readonly ScopedItemOptions _options = ScopedItemOptions.AllScope | ScopedItemOptions.ReadOnly;
Comment on lines +82 to +96
Copy link
Collaborator

@vexx32 vexx32 May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I remembering wrong or was this file removed in a recent PR since it only functions to add command aliases, which were moved to attributes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still not merged.

}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ internal ParameterBinder(
/// <summary>
/// Parameter names list.
/// </summary>
private List<string> parameterNamesList = new List<string>();
private readonly List<string> parameterNamesList = new List<string>();

/// <summary>
/// <para>
Expand All @@ -275,7 +275,7 @@ internal ParameterBinder(
/// <summary>
/// Parameter names list before begin process.
/// </summary>
private List<string> parameterNamesListAtBeginProcess = new List<string>();
private readonly List<string> parameterNamesListAtBeginProcess = new List<string>();

/// <summary>
/// <para>
Expand Down Expand Up @@ -676,7 +676,7 @@ protected virtual void DisposeInternal()
/// <summary>
/// Parameter binder used to resolve parameter set name.
/// </summary>
private ParameterBinder parameterBinder;
private readonly ParameterBinder parameterBinder;

/// <summary>
/// <para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ internal string MethodName
get { return methodName; }
}

private string methodName;
private readonly string methodName;

/// <summary>
/// <para>
Expand All @@ -82,7 +82,7 @@ internal string PropertyName
get { return propertyName; }
}

private string propertyName;
private readonly string propertyName;

/// <summary>
/// <para>
Expand All @@ -96,7 +96,7 @@ internal string QualifierName
get { return qualifierName; }
}

private string qualifierName;
private readonly string qualifierName;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Exception Exception
}
}

private Exception exception;
private readonly Exception exception;

/// <summary>
/// <para>
Expand Down Expand Up @@ -124,7 +124,7 @@ public CimIndicationEventInstanceEventArgs(CimSubscriptionResult result)
/// subscription result
/// </para>
/// </summary>
private CimSubscriptionResult result;
private readonly CimSubscriptionResult result;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ internal string MethodName
}
}

private string methodName;
private readonly string methodName;

/// <summary>
/// <para>parameters collection</para>
Expand All @@ -70,7 +70,7 @@ internal CimMethodParametersCollection ParametersCollection
}
}

private CimMethodParametersCollection collection;
private readonly CimMethodParametersCollection collection;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ public string Message
}
}

private string message;
private readonly string message;

/// <summary>
/// Prompt type -Normal or Critical.
/// </summary>
private CimPromptType prompt;
private readonly CimPromptType prompt;

#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public CimSubscriptionResult Result
}
}

private CimSubscriptionResult result;
private readonly CimSubscriptionResult result;

/// <summary>
/// <para>Constructor</para>
Expand Down Expand Up @@ -90,7 +90,7 @@ public Exception Exception
}
}

private Exception exception;
private readonly Exception exception;

/// <summary>
/// <para>Constructor</para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal object ErrorSource
}
}

private object errorSource;
private readonly object errorSource;
}
#endregion

Expand Down Expand Up @@ -352,17 +352,17 @@ protected CimSession CurrentSession
}
}

private CimSession session;
private readonly CimSession session;

/// <summary>
/// Async operation that can be observed.
/// </summary>
private IObservable<object> observable;
private readonly IObservable<object> observable;

/// <summary>
/// <see cref="CimResultContext"/> object used during delivering result.
/// </summary>
private CimResultContext context;
private readonly CimResultContext context;
#endregion
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public uint SessionId
}
}

private uint sessionId;
private readonly uint sessionId;

/// <summary>
/// InstanceId of the cimsession.
Expand All @@ -58,7 +58,7 @@ public string Name
}
}

private string name;
private readonly string name;

/// <summary>
/// Computer name of the cimsession.
Expand All @@ -71,7 +71,7 @@ public string ComputerName
}
}

private string computerName;
private readonly string computerName;

/// <summary>
/// Wrapped cimsession object.
Expand All @@ -84,7 +84,7 @@ public CimSession CimSession
}
}

private CimSession cimSession;
private readonly CimSession cimSession;

/// <summary>
/// Computer name of the cimsession.
Expand All @@ -110,7 +110,7 @@ internal ProtocolType GetProtocolType()
return protocol;
}

private ProtocolType protocol;
private readonly ProtocolType protocol;

/// <summary>
/// PSObject that wrapped the cimSession.
Expand Down Expand Up @@ -231,35 +231,35 @@ internal class CimSessionState : IDisposable
/// Dictionary used to holds all CimSessions in current runspace by session name.
/// </para>
/// </summary>
private Dictionary<string, HashSet<CimSessionWrapper>> curCimSessionsByName;
private readonly Dictionary<string, HashSet<CimSessionWrapper>> curCimSessionsByName;

/// <summary>
/// <para>
/// Dictionary used to holds all CimSessions in current runspace by computer name.
/// </para>
/// </summary>
private Dictionary<string, HashSet<CimSessionWrapper>> curCimSessionsByComputerName;
private readonly Dictionary<string, HashSet<CimSessionWrapper>> curCimSessionsByComputerName;

/// <summary>
/// <para>
/// Dictionary used to holds all CimSessions in current runspace by instance ID.
/// </para>
/// </summary>
private Dictionary<Guid, CimSessionWrapper> curCimSessionsByInstanceId;
private readonly Dictionary<Guid, CimSessionWrapper> curCimSessionsByInstanceId;

/// <summary>
/// <para>
/// Dictionary used to holds all CimSessions in current runspace by session id.
/// </para>
/// </summary>
private Dictionary<uint, CimSessionWrapper> curCimSessionsById;
private readonly Dictionary<uint, CimSessionWrapper> curCimSessionsById;

/// <summary>
/// <para>
/// Dictionary used to link CimSession object with PSObject.
/// </para>
/// </summary>
private Dictionary<CimSession, CimSessionWrapper> curCimSessionWrapper;
private readonly Dictionary<CimSession, CimSessionWrapper> curCimSessionWrapper;

#endregion

Expand Down Expand Up @@ -934,7 +934,7 @@ internal CimSessionWrapper CimSessionWrapper
}
}

private CimSessionWrapper cimSessionWrapper;
private readonly CimSessionWrapper cimSessionWrapper;
}

/// <summary>
Expand Down Expand Up @@ -1052,7 +1052,7 @@ public void ProcessRemainActions(CmdletOperationBase cmdletOperation)
/// <see cref="CimTestSession"/> object.
/// </para>
/// </summary>
private CimTestSession cimTestSession;
private readonly CimTestSession cimTestSession;
#endregion // private members

#region IDisposable
Expand Down
Loading