Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d44fa0d
Replace \((null) != (\w+)\) -> ($2 != $1)
iSazonov May 28, 2018
0e50d2a
Replace \((null) != (\w+.\w+)\) -> ($2 != $1)
iSazonov May 28, 2018
da71c6f
Replace '\((null) != (\w+) ' -> '($2 != $1 '
iSazonov May 28, 2018
3015b35
Replace '(null) != (\w+),' -> '$2 != $1,'
iSazonov May 28, 2018
f4805ce
Replace 'if \((null) != (\w+(.\w+)+)\)' -> 'if ($2 != $1)'
iSazonov May 28, 2018
cd1b49d
Replace 'if \((null) != (.+)\)' -> 'if ($2 != $1)'
iSazonov May 28, 2018
6d86343
Manual replacement 1
iSazonov May 28, 2018
087ab23
Replace 'if \((null) != (\w+.\w+)' -> 'if ($2 != $1'
iSazonov May 28, 2018
2e1f537
Replace '\b(null) != (\w+)\)' -> '$2 != $1)'
iSazonov May 28, 2018
753348e
Replace \b(null) != (\w+.\w+)\) -> '$2 != $1)'
iSazonov May 28, 2018
a801dde
Replace '\b(null) != (\w+.\w+.\w+)\)' -> '$2 != $1)'
iSazonov May 28, 2018
d57088d
Replace '\((null) != (\w+.\w+),' -> '($2 != $1,'
iSazonov May 28, 2018
1487874
Replace '\((null) != (\w+.\w+) ' -> '($2 != $1 '
iSazonov May 28, 2018
757fcf7
Replace '\((null) != (\w+.\w+\[\w+.\w+\])' -> '($2 != $1'
iSazonov May 28, 2018
93890ad
Replace '\b(null) != (\w+.\w+)' -> $2 != $1
iSazonov May 28, 2018
658c33b
Replace '\((null) == (\w+)\)' -> '($2 == $1)'
iSazonov May 28, 2018
9b71fb6
Replace '\((null) == (\w+.\w+)\)' -> '($2 == $1)'
iSazonov May 28, 2018
9bbc5ba
Replace '\((null) == (\w+) ' -> '($2 == $1 '
iSazonov May 28, 2018
9763bd6
Replace 'if \((null) == (\w+.\w+)' -> 'if ($2 == $1'
iSazonov May 28, 2018
68efdaf
Replace '\b(null) == (\w+)\)' -> '$2 == $1)'
iSazonov May 28, 2018
f188b40
Replace '\b(null) == (\w+.\w+)\)' -> '$2 == $1)'
iSazonov May 28, 2018
6d95c4b
Replace '\((null) == (\w+.\w+\["\w+"].\w+)' -> '($2 == $1'
iSazonov May 28, 2018
98b27a2
Replace '\((null) == (\w+.\w+\["\w+"])' -> '($2 == $1'
iSazonov May 28, 2018
eab49d4
[Feature]
iSazonov May 28, 2018
8852a33
Merge branch 'master' into cleanup-codefactor-null
iSazonov Jun 18, 2018
e9cbab6
Remove the awkward wrong code.
daxian-dbw Jun 25, 2018
7506a03
Remove the wrong code.
daxian-dbw Jun 25, 2018
052c215
Update one more similar case.
daxian-dbw Jun 25, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ internal class CimSessionProxy : IDisposable
/// <param name="session">CimSession to be added</param>
internal static void AddCimSessionToTemporaryCache(CimSession session)
{
if (null != session)
if (session != null)
{
lock (temporarySessionCacheLock)
{
Expand All @@ -252,7 +252,7 @@ internal static void AddCimSessionToTemporaryCache(CimSession session)
private static void RemoveCimSessionFromTemporaryCache(CimSession session,
bool dispose)
{
if (null != session)
if (session != null)
{
bool removed = false;
lock (temporarySessionCacheLock)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ protected override void ProcessRecord()
if (this.ClientOnly)
{
string conflictParameterName = null;
if (null != this.ComputerName)
if (this.ComputerName != null)
{
conflictParameterName = @"ComputerName";
}
else if (null != this.CimSession)
else if (this.CimSession != null)
{
conflictParameterName = @"CimSession";
}
if (null != conflictParameterName)
if (conflictParameterName != null)
{
ThrowConflictParameterWasSet(@"New-CimInstance", conflictParameterName, @"ClientOnly");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ private void Process(EventLog log)
+ ": " + e.Message);
throw;
}
if ((null != entry) &&
if ((entry != null) &&
((lastindex == Int32.MinValue
|| lastindex - entry.Index == 1)))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private static int ProcessComparison(Process x, Process y)
/// <returns></returns>
private void RetrieveMatchingProcessesByProcessName()
{
if (null == processNames)
if (processNames == null)
{
_matchingProcesses = new List<Process>(AllProcesses);
return;
Expand Down Expand Up @@ -211,7 +211,7 @@ private void RetrieveMatchingProcessesByProcessName()
/// <returns></returns>
private void RetrieveMatchingProcessesById()
{
if (null == processIds)
if (processIds == null)
{
Diagnostics.Assert(false, "null processIds");
throw PSTraceSource.NewInvalidOperationException();
Expand Down Expand Up @@ -246,7 +246,7 @@ private void RetrieveMatchingProcessesById()
/// <returns></returns>
private void RetrieveProcessesByInput()
{
if (null == InputObject)
if (InputObject == null)
{
Diagnostics.Assert(false, "null InputObject");
throw PSTraceSource.NewInvalidOperationException();
Expand All @@ -271,7 +271,7 @@ internal Process[] AllProcesses
{
get
{
if (null == _allProcesses)
if (_allProcesses == null)
{
List<Process> processes = new List<Process>();
processes.AddRange(Process.GetProcesses());
Expand Down Expand Up @@ -347,7 +347,7 @@ internal void WriteNonTerminatingError(
string message = StringUtil.Format(resourceId,
processName,
processId,
(null == innerException) ? string.Empty : innerException.Message);
(innerException == null) ? string.Empty : innerException.Message);
ProcessCommandException exception =
new ProcessCommandException(message, innerException);
exception.ProcessName = processName;
Expand Down Expand Up @@ -1406,7 +1406,7 @@ private void StopProcess(Process process)
exception = e;
}

if (null != exception)
if (exception != null)
{
if (!TryHasExited(process))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal void WriteNonTerminatingError(
string message = StringUtil.Format(errorMessage,
serviceName,
displayName,
(null == innerException) ? String.Empty : innerException.Message);
(innerException == null) ? String.Empty : innerException.Message);

var exception = new ServiceCommandException(message, innerException);
exception.ServiceName = serviceName;
Expand Down Expand Up @@ -261,7 +261,7 @@ internal ServiceController[] AllServices
{
get
{
if (null == _allServices)
if (_allServices == null)
{
_allServices = ServiceController.GetServices();
}
Expand Down Expand Up @@ -339,7 +339,7 @@ private List<ServiceController> MatchingServicesByServiceName()
{
List<ServiceController> matchingServices = new List<ServiceController>();

if (null == serviceNames)
if (serviceNames == null)
{
foreach (ServiceController service in AllServices)
{
Expand Down Expand Up @@ -399,7 +399,7 @@ private List<ServiceController> MatchingServicesByServiceName()
private List<ServiceController> MatchingServicesByDisplayName()
{
List<ServiceController> matchingServices = new List<ServiceController>();
if (null == DisplayName)
if (DisplayName == null)
{
Diagnostics.Assert(false, "null DisplayName");
throw PSTraceSource.NewInvalidOperationException();
Expand Down Expand Up @@ -439,7 +439,7 @@ private List<ServiceController> MatchingServicesByDisplayName()
private List<ServiceController> MatchingServicesByInput()
{
List<ServiceController> matchingServices = new List<ServiceController>();
if (null == InputObject)
if (InputObject == null)
{
Diagnostics.Assert(false, "null InputObject");
throw PSTraceSource.NewInvalidOperationException();
Expand All @@ -466,9 +466,9 @@ private void IncludeExcludeAdd(
ServiceController service,
bool checkDuplicates)
{
if (null != include && !Matches(service, include))
if (include != null && !Matches(service, include))
return;
if (null != exclude && Matches(service, exclude))
if (exclude != null && Matches(service, exclude))
return;
if (checkDuplicates)
{
Expand All @@ -493,7 +493,7 @@ private void IncludeExcludeAdd(
/// <returns></returns>
private bool Matches(ServiceController service, string[] matchList)
{
if (null == matchList)
if (matchList == null)
throw PSTraceSource.NewArgumentNullException("matchList");
string serviceID = (selectionMode == SelectionMode.DisplayName)
? service.DisplayName
Expand Down Expand Up @@ -846,13 +846,13 @@ internal bool DoStartService(ServiceController serviceController)
catch (InvalidOperationException e)
{
Win32Exception eInner = e.InnerException as Win32Exception;
if (null == eInner
if (eInner == null
|| NativeMethods.ERROR_SERVICE_ALREADY_RUNNING != eInner.NativeErrorCode)
{
exception = e;
}
}
if (null != exception)
if (exception != null)
{
// This service refused to accept the start command,
// so write a non-terminating error.
Expand Down Expand Up @@ -962,13 +962,13 @@ internal List<ServiceController> DoStopService(ServiceController serviceControll
{
Win32Exception eInner =
e.InnerException as Win32Exception;
if (null == eInner
if (eInner == null
|| NativeMethods.ERROR_SERVICE_NOT_ACTIVE != eInner.NativeErrorCode)
{
exception = e;
}
}
if (null != exception)
if (exception != null)
{
// This service refused to accept the stop command,
// so write a non-terminating error.
Expand Down Expand Up @@ -1067,14 +1067,14 @@ internal bool DoPauseService(ServiceController serviceController)
catch (InvalidOperationException e)
{
Win32Exception eInner = e.InnerException as Win32Exception;
if (null != eInner
if (eInner != null
&& NativeMethods.ERROR_SERVICE_NOT_ACTIVE == eInner.NativeErrorCode)
{
serviceNotRunning = true;
}
exception = e;
}
if (null != exception)
if (exception != null)
{
// This service refused to accept the pause command,
// so write a non-terminating error.
Expand Down Expand Up @@ -1145,14 +1145,14 @@ internal bool DoResumeService(ServiceController serviceController)
catch (InvalidOperationException e)
{
Win32Exception eInner = e.InnerException as Win32Exception;
if (null != eInner
if (eInner != null
&& NativeMethods.ERROR_SERVICE_NOT_ACTIVE == eInner.NativeErrorCode)
{
serviceNotRunning = true;
}
exception = e;
}
if (null != exception)
if (exception != null)
{
// This service refused to accept the continue command,
// so write a non-terminating error.
Expand Down Expand Up @@ -1666,7 +1666,7 @@ protected override void ProcessRecord()
}
// Modify startup type or display name or credential
if (!String.IsNullOrEmpty(DisplayName)
|| ServiceStartupType.InvalidValue != StartupType || null != Credential)
|| ServiceStartupType.InvalidValue != StartupType || Credential != null)
{
DWORD dwStartType = NativeMethods.SERVICE_NO_CHANGE;
if (!NativeMethods.TryGetNativeStartupType(StartupType, out dwStartType))
Expand All @@ -1679,7 +1679,7 @@ protected override void ProcessRecord()
}

string username = null;
if (null != Credential)
if (Credential != null)
{
username = Credential.UserName;
password = Marshal.SecureStringToCoTaskMemUnicode(Credential.Password);
Expand Down Expand Up @@ -2024,7 +2024,7 @@ protected override void BeginProcessing()
}
// set up the double-null-terminated lpDependencies parameter
IntPtr lpDependencies = IntPtr.Zero;
if (null != DependsOn)
if (DependsOn != null)
{
int numchars = 1; // final null
foreach (string dependedOn in DependsOn)
Expand Down Expand Up @@ -2052,7 +2052,7 @@ protected override void BeginProcessing()

// set up the Credential parameter
string username = null;
if (null != Credential)
if (Credential != null)
{
username = Credential.UserName;
password = Marshal.SecureStringToCoTaskMemUnicode(Credential.Password);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected override void ProcessRecord()
}
else // ParameterSetName == "Name"
{
if (null != Name)
if (Name != null)
{
// lookup each time zone name (or wildcard pattern)
foreach (string tzname in Name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private void CreateFileStream()
_fs.Dispose();
_fs = null;
// reset the read-only attribute
if (null != _readOnlyFileInfo)
if (_readOnlyFileInfo != null)
_readOnlyFileInfo.Attributes |= FileAttributes.ReadOnly;
}
if (_helper != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ protected override void EndProcessing()
writer = OpenFile(out readOnlyFileInfo);
}

if (null != writer)
if (writer != null)
WriteHeader(writer);

// Now write out the aliases
Expand All @@ -284,7 +284,7 @@ protected override void EndProcessing()
line = GetAliasLine(alias, "set-alias -Name:\"{0}\" -Value:\"{1}\" -Description:\"{2}\" -Option:\"{3}\"");
}

if (null != writer)
if (writer != null)
writer.WriteLine(line);

if (PassThru)
Expand All @@ -295,10 +295,10 @@ protected override void EndProcessing()
}
finally
{
if (null != writer)
if (writer != null)
writer.Dispose();
// reset the read-only attribute
if (null != readOnlyFileInfo)
if (readOnlyFileInfo != null)
readOnlyFileInfo.Attributes |= FileAttributes.ReadOnly;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal override Object GetValue(PSObject liveObject)
// The live object has the liveObjectPropertyName property.
Object liveObjectValue = propertyInfo.Value;
ICollection collectionValue = liveObjectValue as ICollection;
if (null != collectionValue)
if (collectionValue != null)
{
liveObjectValue = _parentCmdlet.ConvertToString(PSObjectHelper.AsPSObject(propertyInfo.Value));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ internal OutWindowProxy(string title, OutputModeOption outPutMode, OutGridViewCo
/// <param name="types">An array of types to add.</param>
internal void AddColumns(string[] propertyNames, string[] displayNames, Type[] types)
{
if (null == propertyNames)
if (propertyNames == null)
{
throw new ArgumentNullException("propertyNames");
}
if (null == displayNames)
if (displayNames == null)
{
throw new ArgumentNullException("displayNames");
}
if (null == types)
if (types == null)
{
throw new ArgumentNullException("types");
}
Expand Down Expand Up @@ -173,7 +173,7 @@ private void AddExtraProperties(PSObject staleObject, PSObject liveObject)
/// </param>
internal void AddItem(PSObject livePSObject)
{
if (null == livePSObject)
if (livePSObject == null)
{
throw new ArgumentNullException("livePSObject");
}
Expand All @@ -199,7 +199,7 @@ internal void AddItem(PSObject livePSObject)
/// </param>
internal void AddHeteroViewItem(PSObject livePSObject)
{
if (null == livePSObject)
if (livePSObject == null)
{
throw new ArgumentNullException("livePSObject");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private List<TableRowItemDefinition> GetActiveTableRowDefinition(TableControlBod
if (matchingRowDefinition == null)
{
Collection<string> typesWithoutPrefix = Deserializer.MaskDeserializationPrefix(typeNames);
if (null != typesWithoutPrefix)
if (typesWithoutPrefix != null)
{
match = new TypeMatch(_expressionFactory, _typeInfoDatabase, typesWithoutPrefix);

Expand Down
Loading