Skip to content

[StyleCleanUp] Fix spacing around keywords (SA1000) #10602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2025
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Microsoft.DotNet.Wpf/src/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ dotnet_diagnostic.IDE0300.severity = suggestion
# IDE1006: Naming Styles
dotnet_diagnostic.IDE1006.severity = suggestion

# SA1000: Spacing around keywords
dotnet_diagnostic.SA1000.severity = suggestion
# SYSLIB1045: Convert to 'GeneratedRegexAttribute'.
dotnet_diagnostic.SYSLIB1045.severity = suggestion

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -158,7 +158,7 @@ protected override void Dispose(bool disposing)
{
try
{
if(disposing)
if (disposing)
{
((IDisposable)_reader).Dispose();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -129,7 +129,7 @@ private bool GetFieldOrPropertyValue(Type type, string name, out object value)

currentType = currentType.BaseType;
}
while(currentType is not null);
while (currentType is not null);

currentType = type;
do
Expand All @@ -143,7 +143,7 @@ private bool GetFieldOrPropertyValue(Type type, string name, out object value)

currentType = currentType.BaseType;
}
while(currentType is not null);
while (currentType is not null);

value = null;
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ObjectWriterContext(XamlSavedContext savedContext,
BaseUri = savedContext.BaseUri;
// If the bottom of the stack is a (no XamlType) Value (reparse) then back-up onto it.
// Otherwise add a blank frame to isolate template use from the saved context.
switch(savedContext.SaveContextType)
switch (savedContext.SaveContextType)
{
case SavedContextType.Template:
// Templates always need a root namescope, to isolate them from the rest of the doc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public XamlNode(XamlNodeType nodeType)
public XamlNode(XamlNodeType nodeType, object data)
{
#if DEBUG
switch(nodeType)
switch (nodeType)
{
case XamlNodeType.StartObject:
Debug.Assert(data is XamlType, "XamlNode ctor, StartObject data is not a XamlType");
Expand Down Expand Up @@ -114,7 +114,7 @@ public XamlNode(LineInfo lineInfo)
public override string ToString()
{
string str = string.Create(TypeConverterHelper.InvariantEnglishUS, $"{NodeType}: ");
switch(NodeType)
switch (NodeType)
{
case XamlNodeType.StartObject:
str += XamlType.Name;
Expand All @@ -133,7 +133,7 @@ public override string ToString()
break;

case XamlNodeType.None:
switch(_internalNodeType)
switch (_internalNodeType)
{
case InternalNodeType.EndOfAttributes:
str += "End Of Attributes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,12 +894,12 @@ public override void WriteNamespace(NamespaceDeclaration namespaceDeclaration)
{
ThrowIfDisposed();
ArgumentNullException.ThrowIfNull(namespaceDeclaration);
if(namespaceDeclaration.Prefix is null)
if (namespaceDeclaration.Prefix is null)
{
throw new ArgumentException(SR.NamespaceDeclarationPrefixCannotBeNull);
}

if(namespaceDeclaration.Namespace is null)
if (namespaceDeclaration.Namespace is null)
{
throw new ArgumentException(SR.NamespaceDeclarationNamespaceCannotBeNull);
}
Expand Down Expand Up @@ -2564,7 +2564,7 @@ private void ProcessNameFixup_Reparse(NameFixupToken token, bool nameResolutionI
}

#if DEBUG
if(token.Target.Property != token.TargetContext.ParentProperty)
if (token.Target.Property != token.TargetContext.ParentProperty)
{
throw new XamlInternalException("Token's Target Property '{0}' != '{1}' the Token's Context parent Property");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void Read()

while (_token == GenericTypeNameScannerToken.NONE)
{
if(IsAtEndOfInput)
if (IsAtEndOfInput)
{
if (_state == State.INNAME)
{
Expand Down Expand Up @@ -197,7 +197,7 @@ private void State_Start()
break;

default:
if(XamlName.IsValidNameStartChar(CurrentChar))
if (XamlName.IsValidNameStartChar(CurrentChar))
{
StartMultiCharToken();
_state = State.INNAME;
Expand All @@ -217,14 +217,14 @@ private void State_Start()

private void State_InName()
{
if(IsAtEndOfInput || IsWhitespaceChar(CurrentChar) || CurrentChar == OpenBracket)
if (IsAtEndOfInput || IsWhitespaceChar(CurrentChar) || CurrentChar == OpenBracket)
{
_token = GenericTypeNameScannerToken.NAME;
_state = State.START;
return;
}

switch(CurrentChar)
switch (CurrentChar)
{
case OpenParen:
_pushedBackSymbol = GenericTypeNameScannerToken.OPEN;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -74,7 +74,7 @@ private void SetBrokenRuleString(string ruleString)

private bool Expect(MeTokenType token, string ruleString)
{
if(_tokenizer.Token != token)
if (_tokenizer.Token != token)
{
SetBrokenRuleString(ruleString);
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -205,7 +205,7 @@ public void Read()
break;
}

if(readString)
if (readString)
{
if (_context.CurrentType.IsMarkupExtension
&& _context.CurrentBracketModeParseParameters is not null
Expand Down Expand Up @@ -352,12 +352,12 @@ private string ReadString()
StringBuilder sb = new StringBuilder();
char ch;

while(!IsAtEndOfInput)
while (!IsAtEndOfInput)
{
ch = CurrentChar;

// handle escaping and quoting first.
if(escaped)
if (escaped)
{
sb.Append(Backslash);
sb.Append(ch);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void InitializeObjectFrameStack()
private void StartObjectFrame()
{
_startObjectDepth += 1;
if(_seenStack.Count <=_startObjectDepth)
if (_seenStack.Count <=_startObjectDepth)
{
_seenStack.Add(new SeenCtorDirectiveFlags());
}
Expand Down Expand Up @@ -274,7 +274,7 @@ private void ReadAheadAndSortCtorProperties()
// then dig in and correct the stream.
//
// if (HaveSeenOutOfOrderCtorDirective)
if(_moveList is not null)
if (_moveList is not null)
{
SortContentsOfReadAheadBuffer();
}
Expand Down Expand Up @@ -613,9 +613,9 @@ private bool AdvanceToNextInstancingMember(int current, int depth, out int end)
end = current;
int originalIdx = _sortingInfoArray[current].OriginalOrderIndex;
XamlMember nextMember = _originalNodesInOrder[originalIdx].Member;
while(!IsInstancingMember(nextMember))
while (!IsInstancingMember(nextMember))
{
if(!AdvanceTo(current, XamlNodeType.StartMember, depth, out end))
if (!AdvanceTo(current, XamlNodeType.StartMember, depth, out end))
{
return false;
}
Expand Down Expand Up @@ -705,7 +705,7 @@ private bool AdvanceTo(int start, XamlNodeType nodeType, int searchDepth, out in
{
XamlNodeType currentNodeType = _sortingInfoArray[idx].XamlNodeType;
int nodeDepth = _sortingInfoArray[idx].Depth;
if(nodeDepth == searchDepth)
if (nodeDepth == searchDepth)
{
if (currentNodeType == nodeType)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -60,7 +60,7 @@ public void Initialize(XamlParserContext context, XamlType tagType, string owner
}
else if (Property.IsDirective)
{
if(Property == XamlLanguage.Space)
if (Property == XamlLanguage.Space)
{
Kind = ScannerAttributeKind.XmlSpace;
}
Expand All @@ -79,7 +79,7 @@ public void Initialize(XamlParserContext context, XamlType tagType, string owner
Kind = ScannerAttributeKind.Directive;
}
}
else if(Property.IsAttachable)
else if (Property.IsAttachable)
{
Kind = ScannerAttributeKind.AttachableProperty;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private XamlPropertyName(XamlName owner, string prefix, string name)

public static XamlPropertyName Parse(string longName)
{
if(string.IsNullOrEmpty(longName))
if (string.IsNullOrEmpty(longName))
{
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ private void PostprocessAttributes(XamlScannerNode node)
// The Name attribute
foreach (XamlAttribute attr in _attributes)
{
switch(attr.Kind)
switch (attr.Kind)
{
case ScannerAttributeKind.Name:
nameAttribute = attr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static bool IsLooseSubClassOf(Type t1, Type t2)
return false; // strictly testing for sub-class
}

for(Type baseType = t1.BaseType; baseType is not null; baseType = baseType.BaseType)
for (Type baseType = t1.BaseType; baseType is not null; baseType = baseType.BaseType)
{
if (AssemblyQualifiedNameEquals(baseType, t2))
{
Expand Down
Loading