Skip to content

Commit 78d7e1f

Browse files
authored
[StyleCleanUp] Addressing SA warnings Part 4 (#10126)
Resolve the following SA Ids: 1129, 1121, 1028, 1027, 1014, 1005, 1001
1 parent 9376afc commit 78d7e1f

Some content is hidden

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

58 files changed

+244
-265
lines changed

src/Microsoft.DotNet.Wpf/src/.editorconfig

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -290,27 +290,6 @@ dotnet_diagnostic.IDE0300.severity = suggestion
290290
# IDE1006: Naming Styles
291291
dotnet_diagnostic.IDE1006.severity = suggestion
292292

293-
# SA1001: Commas should not be preceded by whitespace
294-
dotnet_diagnostic.SA1001.severity = suggestion
295-
296-
# SA1005: Single line comment should begin with a space
297-
dotnet_diagnostic.SA1005.severity = suggestion
298-
299-
# SA1014: Opening generic brackets should not be preceded by a space
300-
dotnet_diagnostic.SA1014.severity = suggestion
301-
302-
# SA1027: Tabs and spaces should be used correctly
303-
dotnet_diagnostic.SA1027.severity = suggestion
304-
305-
# SA1028: Code should not contain trailing whitespace
306-
dotnet_diagnostic.SA1028.severity = suggestion
307-
308-
# SA1121: Use built-in type alias
309-
dotnet_diagnostic.SA1121.severity = suggestion
310-
311-
# SA1129: Do not use default value type constructor
312-
dotnet_diagnostic.SA1129.severity = suggestion
313-
314293
# SA1400: Member should declare an access modifier
315294
dotnet_diagnostic.SA1400.severity = suggestion
316295

src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SafeSecurityHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ static AssemblyName GetAssemblyName(Assembly assembly)
166166
_assemblies = new Dictionary<object, AssemblyName>();
167167
}
168168
else
169-
{
169+
{
170170
if (_assemblies.TryGetValue(key, out result))
171171
{
172172
return result;
173173
}
174-
}
174+
}
175175

176176
//
177177
// We use AssemblyName ctor here because GetName demands FileIOPermission

src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Context/XamlContextStack.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace MS.Internal.Xaml.Context
1111
{
12-
//This stack has the following features:
12+
// This stack has the following features:
1313
// 1) it recycles frames
1414
// 2) it is <T>, and avoids activator.createinstance with the creationDelegate
1515
class XamlContextStack<T> where T : XamlFrame
@@ -59,7 +59,7 @@ public XamlContextStack(XamlContextStack<T> source, bool copy)
5959
}
6060
}
6161

62-
//allocate a new frame as the new currentFrame;
62+
// allocate a new frame as the new currentFrame;
6363
private void Grow()
6464
{
6565
T lastFrame = _currentFrame;
@@ -94,15 +94,15 @@ public T GetFrame(int depth)
9494
return iteratorFrame;
9595
}
9696

97-
//Consumers of this stack call PushScope, and we'll either allocate a new frame
97+
// Consumers of this stack call PushScope, and we'll either allocate a new frame
9898
// or we'll grab one from our recycled linked list.
9999
public void PushScope()
100100
{
101101
if (_recycledFrame is null)
102102
{
103103
Grow();
104104
}
105-
else //use recycled frame
105+
else // use recycled frame
106106
{
107107
T lastFrame = _currentFrame;
108108
_currentFrame = _recycledFrame;
@@ -114,7 +114,7 @@ public void PushScope()
114114
Debug.Assert(CurrentFrame.Depth == Depth);
115115
}
116116

117-
//Consumers of this stack call PopScope, and we'll move the currentFrame from the main
117+
// Consumers of this stack call PopScope, and we'll move the currentFrame from the main
118118
// linked list to the recylced linked list and call .Reset
119119
public void PopScope()
120120
{
@@ -133,7 +133,7 @@ public int Depth
133133
set { _depth = value; }
134134
}
135135

136-
//In case the stack needs to survive and you don't want to keep the recylced frames around.
136+
// In case the stack needs to survive and you don't want to keep the recylced frames around.
137137
public void Trim()
138138
{
139139
_recycledFrame = null;

src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Parser/SpecialBracketCharacters.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#nullable disable
66

7-
// Description: Data model for the Bracket characters specified on a Markup Extension property.
7+
// Description: Data model for the Bracket characters specified on a Markup Extension property.
88

99
using System;
1010
using System.Collections.Generic;
@@ -31,7 +31,7 @@ internal SpecialBracketCharacters()
3131
BeginInit();
3232
}
3333

34-
internal SpecialBracketCharacters(IReadOnlyDictionary<char,char> attributeList)
34+
internal SpecialBracketCharacters(IReadOnlyDictionary<char, char> attributeList)
3535
{
3636
BeginInit();
3737
if (attributeList is not null && attributeList.Count > 0)
@@ -53,7 +53,7 @@ internal void AddBracketCharacters(char openingBracket, char closingBracket)
5353
}
5454
}
5555

56-
private void Tokenize(IReadOnlyDictionary<char,char> attributeList)
56+
private void Tokenize(IReadOnlyDictionary<char, char> attributeList)
5757
{
5858
if (_initializing)
5959
{

src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
using MS.Internal.WindowsBase;
1212
#endif
1313

14-
//using MS.Internal.PresentationCore;
15-
//using SR=MS.Internal.WindowsBase.SR;
14+
// using MS.Internal.PresentationCore;
15+
// using SR=MS.Internal.WindowsBase.SR;
1616

1717
// These classes implement a frugal storage model for lists of type <T>.
1818
// Performance measurements show that Avalon has many lists that contain
@@ -2289,7 +2289,7 @@ public void CopyTo(T[] array, int index)
22892289

22902290
public FrugalStructList<T> Clone()
22912291
{
2292-
FrugalStructList<T> myClone = new FrugalStructList<T>();
2292+
FrugalStructList<T> myClone = default(FrugalStructList<T>);
22932293

22942294
if (_listStore is not null)
22952295
{

src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#nullable disable
66

7-
// Description: Specifies that the whitespace surrounding an element should be trimmed.
7+
// Description: Specifies that the whitespace surrounding an element should be trimmed.
88

99
using System;
1010
using System.IO;
@@ -333,7 +333,7 @@ private static string GetCustomAttributeData(CustomAttributeData cad,
333333
if (constructorArguments.Count == 1 && !noArgs)
334334
{
335335
CustomAttributeTypedArgument tca = constructorArguments[0];
336-
attrValue = tca.Value as String;
336+
attrValue = tca.Value as string;
337337
#if PBTCOMPILER
338338
if (attrValue == null && allowTypeAlso && tca.ArgumentType == GetMscorlibType(typeof(Type)))
339339
#else
@@ -433,12 +433,12 @@ private static Assembly LoadAssemblyHelper(string assemblyGivenName, string asse
433433
// Check if the current AppDomain has this assembly loaded for some other reason.
434434
// If so, then just use that assembly and don't attempt to load another copy of it.
435435
// Only do this if no path is provided.
436-
if (String.IsNullOrEmpty(assemblyPath))
436+
if (string.IsNullOrEmpty(assemblyPath))
437437
retassem = SafeSecurityHelper.GetLoadedAssembly(assemblyName);
438438

439439
if (retassem is null)
440440
{
441-
if (!String.IsNullOrEmpty(assemblyPath))
441+
if (!string.IsNullOrEmpty(assemblyPath))
442442
{
443443
// assemblyPath is set, Load the assembly from this specified place.
444444
// the path must be full file path which contains directory, file name and extension.

src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/TypeConverterHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
// Description: Specifies that the whitespace surrounding an element should be trimmed.
5+
// Description: Specifies that the whitespace surrounding an element should be trimmed.
66

77
using System;
88
using System.Reflection;

src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public override bool Read()
162162
ScanForEndCompatibility(previousElementDepth);
163163
}
164164

165-
bool more = Reader.Read(); //passed as ref arg to ReadStartElement and ReadEndElement
165+
bool more = Reader.Read(); // passed as ref arg to ReadStartElement and ReadEndElement
166166
bool result = false;
167167

168168
while (more)
@@ -327,7 +327,7 @@ private bool ReadEndElement(ref bool more)
327327
}
328328

329329
_depthOffset--;
330-
PopScope(); //we know we can pop, so no need to scan
330+
PopScope(); // we know we can pop, so no need to scan
331331
more = Reader.Read();
332332
}
333333
else
@@ -821,7 +821,7 @@ private string MapNewNamespace(string namespaceName)
821821
{
822822
AddKnownNamespace(namespaceName);
823823

824-
if (String.IsNullOrEmpty(mappedNamespace) || namespaceName == mappedNamespace)
824+
if (string.IsNullOrEmpty(mappedNamespace) || namespaceName == mappedNamespace)
825825
{
826826
_namespaceMap[namespaceName] = namespaceName;
827827
}
@@ -958,7 +958,7 @@ private IEnumerable<NamespaceElementPair> ParseContentToNamespaceElementPair(str
958958
foreach (string pair in content.Trim().Split(' '))
959959
{
960960
// check each non-null, non-empty space-delineated namespace/element pair
961-
if (!String.IsNullOrEmpty(pair))
961+
if (!string.IsNullOrEmpty(pair))
962962
{
963963
int colonIndex = pair.IndexOf(':');
964964
int length = pair.Length;
@@ -1006,7 +1006,7 @@ private IEnumerable<string> PrefixesToNamespaces(string prefixes)
10061006
foreach (string prefix in prefixes.Trim().Split(' '))
10071007
{
10081008
// check each non-null, non-empty space-delineated prefix
1009-
if (!String.IsNullOrEmpty(prefix))
1009+
if (!string.IsNullOrEmpty(prefix))
10101010
{
10111011
string namespaceUri = LookupNamespace(prefix);
10121012

@@ -1220,7 +1220,7 @@ private void HandleChoice(int elementDepth, ref bool more)
12201220
Error(SR.XCRRequiresAttribNotFound);
12211221
}
12221222

1223-
if (String.IsNullOrEmpty(requiresValue))
1223+
if (string.IsNullOrEmpty(requiresValue))
12241224
{
12251225
// Requires attribute may not be empty
12261226
Error(SR.XCRInvalidRequiresAttribute);

src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlWrappingReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ string IXmlNamespaceResolver.LookupPrefix( string namespaceName )
136136
return (_readerAsResolver is null) ? null : _readerAsResolver.LookupPrefix( namespaceName );
137137
}
138138

139-
IDictionary<string,string> IXmlNamespaceResolver.GetNamespacesInScope ( XmlNamespaceScope scope )
139+
IDictionary<string, string> IXmlNamespaceResolver.GetNamespacesInScope ( XmlNamespaceScope scope )
140140
{
141141
return (_readerAsResolver is null) ? null : _readerAsResolver.GetNamespacesInScope( scope );
142142
}

src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// New since v4 RTM:
3030

31-
//this is used by subclasses, bad FxCop detection
31+
// this is used by subclasses, bad FxCop detection
3232
[assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Xaml.MS.Impl.FrugalObjectList`1+Compacter", Justification = "Non-Breaking")]
3333
#endregion
3434

0 commit comments

Comments
 (0)