Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Enable SA1000: Spacing around keywords
Do not enable for `src/tools/illink/` due to different code style.
  • Loading branch information
xtqqczze committed Feb 8, 2025
commit 27c1ef1d7a2193809d47bcd16b0cbf0f6e107e0e
3 changes: 1 addition & 2 deletions eng/CodeAnalysis.src.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1139,8 +1139,7 @@ dotnet_diagnostic.RS2008.severity = warning
dotnet_diagnostic.SA0001.severity = none

# SA1000: Spacing around keywords
# suggestion until https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3478 is resolved
dotnet_diagnostic.SA1000.severity = suggestion
dotnet_diagnostic.SA1000.severity = warning

# SA1001: Commas should not be preceded by whitespace
dotnet_diagnostic.SA1001.severity = warning
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/Common/CommandLineHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static List<string> BuildPathList(IReadOnlyList<CliToken> tokens)

public static TargetOS GetTargetOS(string token)
{
if(string.IsNullOrEmpty(token))
if (string.IsNullOrEmpty(token))
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return TargetOS.Windows;
Expand Down Expand Up @@ -87,7 +87,7 @@ public static TargetOS GetTargetOS(string token)

public static TargetArchitecture GetTargetArchitecture(string token)
{
if(string.IsNullOrEmpty(token))
if (string.IsNullOrEmpty(token))
{
return RuntimeInformation.ProcessArchitecture switch
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ IntPtr LocalObjectToHandle(object input)

bool isType = nativeSchema[index + 1].InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes;

fixed(PgoInstrumentationSchema* pSchema = &nativeSchema[index])
fixed (PgoInstrumentationSchema* pSchema = &nativeSchema[index])
{
fixed(byte* pInstrumentationData = &instrumentationData[0])
fixed (byte* pInstrumentationData = &instrumentationData[0])
{
// We're going to store only the most popular type/method to reduce size of the profile
LikelyClassMethodRecord* likelyClassMethods = stackalloc LikelyClassMethodRecord[1];
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,25 +497,25 @@ public void ExpandInstructionSetByImplication(TargetArchitecture architecture)

public static InstructionSet ConvertToImpliedInstructionSetForVectorInstructionSets(TargetArchitecture architecture, InstructionSet input)
{
switch(architecture)
switch (architecture)
{
case TargetArchitecture.ARM64:
switch(input)
switch (input)
{
case InstructionSet.ARM64_Vector64: return InstructionSet.ARM64_AdvSimd;
case InstructionSet.ARM64_Vector128: return InstructionSet.ARM64_AdvSimd;
}
break;
case TargetArchitecture.X64:
switch(input)
switch (input)
{
case InstructionSet.X64_Vector128: return InstructionSet.X64_SSE;
case InstructionSet.X64_Vector256: return InstructionSet.X64_AVX;
case InstructionSet.X64_Vector512: return InstructionSet.X64_AVX512F;
}
break;
case TargetArchitecture.X86:
switch(input)
switch (input)
{
case InstructionSet.X86_Vector128: return InstructionSet.X86_SSE;
case InstructionSet.X86_Vector256: return InstructionSet.X86_AVX;
Expand Down Expand Up @@ -984,7 +984,7 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
do
{
oldflags = resultflags;
switch(architecture)
switch (architecture)
{

case TargetArchitecture.ARM64:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private static bool CanCastConstraint(ref ArrayBuilder<TypeDesc> instantiatedCon

public static bool CheckValidInstantiationArguments(this Instantiation instantiation)
{
foreach(var arg in instantiation)
foreach (var arg in instantiation)
{
if (arg.IsPointer || arg.IsByRef || arg.IsGenericParameter || arg.IsVoid)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public TypeDesc GetInlineArrayType(InlineArrayCandidate candidate)

public FieldDesc GetPInvokeLazyFixupField(MethodDesc method, MethodSignature nativeSig)
{
return _pInvokeLazyFixupFieldHashtable.GetOrCreateValue(new (method, nativeSig));
return _pInvokeLazyFixupFieldHashtable.GetOrCreateValue(new(method, nativeSig));
}

public MethodDesc GetPInvokeCalliStub(MethodSignature signature, ModuleDesc moduleContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private void EmitDispatchMap(ref ObjectDataBuilder builder, NodeFactory factory)
if (!declMethod.Signature.IsStatic && !needsEntriesForInstanceInterfaceMethodImpls)
continue;

if(!interfaceType.IsTypeDefinition)
if (!interfaceType.IsTypeDefinition)
declMethod = factory.TypeSystemContext.GetMethodForInstantiatedType(declMethod.GetTypicalMethodDefinition(), (InstantiatedType)definitionInterfaceType);

var implMethod = declMethod.Signature.IsStatic ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static void GetGenericVirtualMethodImplementationDependencies(ref Depende

if (!openImplementationType.IsInterface)
{
for(int index = 0; index < openImplementationType.RuntimeInterfaces.Length; index++)
for (int index = 0; index < openImplementationType.RuntimeInterfaces.Length; index++)
{
if (openImplementationType.RuntimeInterfaces[index] == callingMethod.OwningType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static bool MethodHasAssociatedData(IMethodNode methodNode)
{
// Instantiating unboxing stubs. We need to store their non-unboxing target pointer (looked up by runtime)
ISpecialUnboxThunkNode unboxThunk = methodNode as ISpecialUnboxThunkNode;
if(unboxThunk != null && unboxThunk.IsSpecialUnboxingThunk)
if (unboxThunk != null && unboxThunk.IsSpecialUnboxingThunk)
return true;

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto
{
_staticDependencies = new DependencyList();

foreach(var entry in ScanForGenericVirtualMethodEntries())
foreach (var entry in ScanForGenericVirtualMethodEntries())
GenericVirtualMethodTableNode.GetGenericVirtualMethodImplementationDependencies(ref _staticDependencies, context, entry.CallingMethod, entry.ImplementationMethod);

foreach (var entry in ScanForInterfaceGenericVirtualMethodEntries())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void EmitExportedMethods()
foreach (var method in _methods)
streamWriter.WriteLine($" {method.GetUnmanagedCallersOnlyExportName()}");
}
else if(_context.Target.IsApplePlatform)
else if (_context.Target.IsApplePlatform)
{
foreach (string symbol in _exportSymbols)
streamWriter.WriteLine($"_{symbol}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private EmptyProfileData()
{
}

public override MibcConfig Config { get; } = new ();
public override MibcConfig Config { get; } = new();

public override bool PartialNGen => false;

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/cdac-build-tool/ComposeCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal sealed class ComposeCommand : CliCommand
private readonly CliOption<string> outputFile = new("-o") { Arity = ArgumentArity.ExactlyOne, HelpName = "OUTPUT", Required = true, Description = "Output file" };
private readonly CliOption<string[]> contractFile = new("-c") { Arity = ArgumentArity.ZeroOrMore, HelpName = "CONTRACT", Description = "Contract file (may be specified multiple times)" };
private readonly CliOption<string> baselinePath = new("-b", "--baseline") { Arity = ArgumentArity.ExactlyOne, HelpName = "BASELINEPATH", Description = "Directory containing the baseline contracts"};
private readonly CliOption<string> templateFile = new ("-i", "--input-template") { Arity = ArgumentArity.ExactlyOne, HelpName = "TEMPLATE", Description = "Contract descriptor template to be filled in" };
private readonly CliOption<string> templateFile = new("-i", "--input-template") { Arity = ArgumentArity.ExactlyOne, HelpName = "TEMPLATE", Description = "Contract descriptor template to be filled in" };
private readonly CliOption<bool> _verboseOption;
public ComposeCommand(CliOption<bool> verboseOption) : base("compose")
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/cdac-build-tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Program
{
public static async Task<int> Main(string[] args)
{
CliRootCommand rootCommand = new ();
CliRootCommand rootCommand = new();
var verboseOption = new CliOption<bool>("-v", "--verbose") {Recursive = true, Description = "Verbose"};
rootCommand.Add(verboseOption);
rootCommand.Add(new DiagramDirective());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ private unsafe void Initialize(Guid eventSourceGuid, string eventSourceName, str
// Register the provider with ETW
Func<EventSource?> eventSourceFactory = () => this;
OverrideEventProvider? etwProvider = EventSourceInitHelper.TryGetPreregisteredEtwProvider(eventSourceGuid);
if(etwProvider == null)
if (etwProvider == null)
{
etwProvider = new OverrideEventProvider(eventSourceFactory, EventProviderType.ETW);
etwProvider.Register(eventSourceGuid, eventSourceName);
Expand Down Expand Up @@ -3879,7 +3879,7 @@ private bool SelfDescribingEvents
#endif
internal static void InitializeDefaultEventSources()
{
if(!EventSource.IsSupported)
if (!EventSource.IsSupported)
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ internal static void Fill(ref byte dest, byte value, nuint len)
if (len >= (nuint)Vector<byte>.Count)
{
// We have enough data for at least one vectorized write.
Vector<byte> vector = new (value);
Vector<byte> vector = new(value);
nuint stopLoopAtOffset = len & (nuint)(nint)(2 * (int)-Vector<byte>.Count); // intentional sign extension carries the negative bit
nuint offset = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public CachingContractRegistry(Target target, TryGetContractVersionDelegate tryG
{
_target = target;
_tryGetContractVersion = tryGetContractVersion;
_factories = new () {
_factories = new() {
[typeof(IException)] = new ExceptionFactory(),
[typeof(ILoader)] = new LoaderFactory(),
[typeof(IEcmaMetadata)] = new EcmaMetadataFactory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private static void AppendTypeCore(ref TypeNameBuilder tnb, Contracts.TypeHandle
// The following flags in the FormatFlags argument are significant: FormatNamespace FormatFullInst FormatAssembly FormatNoVersion
private static void AppendInst(Target target, StringBuilder stringBuilder, ReadOnlySpan<TypeHandle> inst, TypeNameFormat format)
{
TypeNameBuilder tnb = new (stringBuilder, target, format, initialStateIsName: true);
TypeNameBuilder tnb = new(stringBuilder, target, format, initialStateIsName: true);
AppendInst(ref tnb, inst, format);
}

Expand Down
3 changes: 3 additions & 0 deletions src/tools/illink/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ file_header_template = Copyright (c) .NET Foundation and contributors. All right

### Code Style Analyzers

# Spacing around keywords
dotnet_diagnostic.SA1000.severity = none

# Access modifier must be declared
dotnet_diagnostic.SA1400.severity = none

Expand Down
Loading