Skip to content

Commit

Permalink
[src] Add a comma after the last value in multi-line initializers. (#…
Browse files Browse the repository at this point in the history
…22251)

Enable the SA1413 stylecop rule - "Use trailing comma in multi-line
initializers", and fix all resulting build warnings.

Most importantly, this means adding a comma after the last enum value in an
enum. The stylecop rule also detects this for other types if multi-line
initializers, such as object initializers and array creations, so fix those as
well (there weren't many of these though).
  • Loading branch information
rolfbjarne authored Mar 3, 2025
1 parent 2238ec8 commit ad03dc9
Show file tree
Hide file tree
Showing 142 changed files with 422 additions and 420 deletions.
2 changes: 1 addition & 1 deletion src/AVFoundation/AVLayerVideoGravity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace AVFoundation {
public enum AVLayerVideoGravity {
ResizeAspect,
ResizeAspectFill,
Resize
Resize,
}

partial class AVPlayerLayer {
Expand Down
2 changes: 1 addition & 1 deletion src/AVFoundation/AVPlayerItemVideoOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial class AVPlayerItemVideoOutput {

enum InitMode {
PixelAttributes,
OutputSettings
OutputSettings,
}

AVPlayerItemVideoOutput (NSDictionary? data, AVPlayerItemVideoOutput.InitMode mode) : base (NSObjectFlag.Empty)
Expand Down
6 changes: 3 additions & 3 deletions src/AVFoundation/AVVideoSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum AVVideoCodec : int {
/// <summary>To be added.</summary>
H264 = 1,
/// <summary>To be added.</summary>
JPEG = 2
JPEG = 2,
}

// Convenience enum for native strings - AVVideoSettings.h
Expand All @@ -55,7 +55,7 @@ public enum AVVideoScalingMode : int {
/// <summary>Preserves aspect ratio of the source and fills remaining areas with black to fit destination dimensions.</summary>
ResizeAspect,
/// <summary>Preserves aspect ratio of the source and crops picture to fit destination dimensions.</summary>
ResizeAspectFill
ResizeAspectFill,
}

// Convenience enum for native strings - AVVideoSettings.h
Expand Down Expand Up @@ -164,7 +164,7 @@ public enum AVVideoH264EntropyMode {
/// <summary>To be added.</summary>
AdaptiveVariableLength,
/// <summary>To be added.</summary>
AdaptiveBinaryArithmetic
AdaptiveBinaryArithmetic,
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/AVFoundation/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ public enum AVCaptureLensStabilizationStatus : long {
Off = 1,
Active = 2,
OutOfRange = 3,
Unavailable = 4
Unavailable = 4,
}

[Introduced (PlatformName.MacCatalyst, 14, 0)]
Expand Down
2 changes: 1 addition & 1 deletion src/AVKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum AVPlayerViewControlsStyle : long {
Inline,
Floating,
Minimal,
Default = Inline
Default = Inline,
}
#endif

Expand Down
8 changes: 4 additions & 4 deletions src/Accelerate/vImageTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public enum vImageError : long {
InvalidRowBytes = -21777,
InvalidImageFormat = -21778,
ColorSyncIsAbsent = -21779,
OutOfPlaceOperationRequired = -21780
OutOfPlaceOperationRequired = -21780,
}

// anonymous enum - Transform.h
Expand All @@ -157,7 +157,7 @@ public enum vImageGamma {
k11over9_HalfPrecision = 8,
k9over11_HalfPrecision = 9,
kBT709_ForwardHalfPrecision = 10,
kBT709_ReverseHalfPrecision = 11
kBT709_ReverseHalfPrecision = 11,
};

// vImageMDTableUsageHint (untyped) - Transform.h
Expand All @@ -170,7 +170,7 @@ public enum vImageMDTableUsageHint : int {
public enum vImageInterpolationMethod : int {
None = 0,
Full = 1,
Half = 2
Half = 2,
}

[Flags]
Expand All @@ -186,7 +186,7 @@ public enum vImageFlags : uint {
TruncateKernel = 64,
GetTempBufferSize = 128,
PrintDiagnosticsToConsole = 256,
NoAllocate = 512
NoAllocate = 512,
}

#if NET
Expand Down
2 changes: 1 addition & 1 deletion src/Accounts/AccountStoreOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Accounts {
public enum ACFacebookAudience {
Everyone = 1,
Friends,
OnlyMe
OnlyMe,
}

#if NET
Expand Down
4 changes: 2 additions & 2 deletions src/AddressBook/ABEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum ABAddressBookError {
public enum ABAddressBookError : long {
#endif
OperationNotPermittedByStore = 0,
OperationNotPermittedByUserError
OperationNotPermittedByUserError,
}

/// <summary>An enumeration whose values specify the possible results of the <see cref="M:AddressBook.ABAddressBook.GetAuthorizationStatus" /> method.</summary>
Expand All @@ -66,7 +66,7 @@ public enum ABAuthorizationStatus : long {
NotDetermined = 0,
Restricted,
Denied,
Authorized
Authorized,
}

/// <summary>How to sort records.</summary>
Expand Down
4 changes: 2 additions & 2 deletions src/AppKit/EventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public enum NSFontCollectionAction {
Unknown,
Shown,
Hidden,
Renamed
Renamed,
}

public partial class NSFontCollectionChangedEventArgs {
Expand All @@ -64,7 +64,7 @@ public NSFontCollectionVisibility Visibility {
public enum NSPopoverCloseReason {
Unknown,
Standard,
DetachToWindow
DetachToWindow,
}

public partial class NSPopoverCloseEventArgs {
Expand Down
2 changes: 1 addition & 1 deletion src/AppKit/NSStatusBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace AppKit {
public enum NSStatusItemLength {
Variable = -1,
Square = -2
Square = -2,
}

public partial class NSStatusBar {
Expand Down
12 changes: 6 additions & 6 deletions src/AppKit/XEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ namespace AppKit {
[Native]
public enum NSPrintRenderingQuality : long {
Best,
Responsive
Responsive,
}

[NoMacCatalyst]
[Native]
public enum NSCorrectionIndicatorType : long {
Default = 0,
Reversion,
Guesses
Guesses,
}

[NoMacCatalyst]
Expand All @@ -36,7 +36,7 @@ public enum NSCorrectionResponse : long {
Rejected,
Ignored,
Edited,
Reverted
Reverted,
}

[NoMacCatalyst]
Expand All @@ -45,7 +45,7 @@ public enum NSTextFinderMatchingType : long {
Contains = 0,
StartsWith = 1,
FullWord = 2,
EndsWith = 3
EndsWith = 3,
}

[NoMacCatalyst]
Expand All @@ -67,7 +67,7 @@ public enum NSCharacterCollection : ulong {
AdobeJapan2 = 4,

/// <summary>Adobe-Korea1</summary>
AdobeKorea1 = 5
AdobeKorea1 = 5,
}

[NoMacCatalyst]
Expand All @@ -81,6 +81,6 @@ public enum NSSpellingState : int
{
None = 0x0,
Spelling = 0x1,
Grammar = 0x2
Grammar = 0x2,
}
}
4 changes: 2 additions & 2 deletions src/AudioToolbox/AudioConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public enum AudioConverterQuality // typedef UInt32 AudioConverterPropertyID
/// <summary>Represents low quality.</summary>
Low = 0x20,
/// <summary>Represents minimum quality.</summary>
Min = 0
Min = 0,
}

public enum AudioConverterPrimeMethod // typedef UInt32 AudioConverterPropertyID
Expand All @@ -104,7 +104,7 @@ public enum AudioConverterPrimeMethod // typedef UInt32 AudioConverterPropertyID
/// <summary>Represents primes with trailing input frames only.</summary>
Normal = 1,
/// <summary>Represents primes with both leading and trailing input frames to be silence.</summary>
None = 2
None = 2,
}

[Flags]
Expand Down
10 changes: 5 additions & 5 deletions src/AudioToolbox/AudioFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ public enum AudioFilePermission {
/// <summary>To be added.</summary>
Write = 0x02,
/// <summary>To be added.</summary>
ReadWrite = 0x03
ReadWrite = 0x03,
}

[Flags]
public enum AudioFileFlags { // UInt32 in AudioFileCreateWithURL()
/// <summary>To be added.</summary>
EraseFlags = 1,
/// <summary>If this flag is set, audio data will be written without page alignment. This will make the data more compact but possibly slow readout.</summary>
DontPageAlignAudioData = 2
DontPageAlignAudioData = 2,
}

public enum AudioFileProperty { // typedef UInt32 AudioFilePropertyID
Expand Down Expand Up @@ -242,7 +242,7 @@ public enum AudioFileLoopDirection { // Unused?
/// <summary>To be added.</summary>
ForwardAndBackward = 2,
/// <summary>To be added.</summary>
Backward = 3
Backward = 3,
}

public enum AudioFileChunkType : uint // CoreAudio.framework - CoreAudioTypes.h - "four char code IDs"
Expand Down Expand Up @@ -305,7 +305,7 @@ struct AudioBytePacketTranslation {
[Flags]
enum BytePacketTranslationFlags : uint // Stored in UInt32 in AudioBytePacketTranslation - AudioFile.h
{
IsEstimate = 1
IsEstimate = 1,
}

#if NET
Expand Down Expand Up @@ -683,7 +683,7 @@ public enum AudioFileRegionFlags : uint // UInt32 in AudioFileRegion
/// <summary>The region is played normally.</summary>
PlayForward = 2,
/// <summary>The region is played in reverse.</summary>
PlayBackward = 4
PlayBackward = 4,
}

#if NET
Expand Down
8 changes: 4 additions & 4 deletions src/AudioToolbox/AudioFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public enum AudioFormatError : int // Implictly cast to OSType
/// <summary>To be added.</summary>
UnsupportedDataFormat = 0x666d743f, // 'fmt?'
/// <summary>To be added.</summary>
UnknownFormat = 0x21666d74 // '!fmt'
UnknownFormat = 0x21666d74, // '!fmt'

// TODO: Not documented
// '!dat'
Expand All @@ -124,7 +124,7 @@ public enum AudioBalanceFadeType : uint // UInt32 in AudioBalanceFades
/// <summary>Overall gain is not allowed to exceed 1.0.</summary>
MaxUnityGain = 0,
/// <summary>Overall loudness remains constant, but gain may be as high as 1.414 (+3dB).</summary>
EqualPower = 1
EqualPower = 1,
}

#if NET
Expand Down Expand Up @@ -215,7 +215,7 @@ public enum PanningMode : uint // UInt32 in AudioPanningInfo
/// <summary>To be added.</summary>
SoundField = 3,
/// <summary>To be added.</summary>
VectorBasedPanning = 4
VectorBasedPanning = 4,
}

#if NET
Expand Down Expand Up @@ -298,7 +298,7 @@ Layout ToStruct ()
Coord0 = Coordinates [0],
Coord1 = Coordinates [1],
Coord2 = Coordinates [2],
GainScale = GainScale
GainScale = GainScale,
};

if (OutputChannelMap is not null) {
Expand Down
10 changes: 5 additions & 5 deletions src/AudioToolbox/AudioQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public enum AudioQueueStatus { // Implictly cast to OSType

// From kAudio_
/// <summary>To be added.</summary>
GeneralParamError = -50
GeneralParamError = -50,
}

#if NET
Expand Down Expand Up @@ -269,7 +269,7 @@ public enum AudioQueueTimePitchAlgorithm : uint {
LowQualityZeroLatency = 0x6c717a6c, // lqzl
#endif
/// <summary>To be added.</summary>
Varispeed = 0x76737064 // vspd
Varispeed = 0x76737064, // vspd
}

public enum AudioQueueHardwareCodecPolicy { // A AudioQueuePropertyID (UInt32)
Expand All @@ -282,7 +282,7 @@ public enum AudioQueueHardwareCodecPolicy { // A AudioQueuePropertyID (UInt32)
/// <summary>To be added.</summary>
PreferSoftware = 3,
/// <summary>To be added.</summary>
PreferHardware = 4
PreferHardware = 4,
}

public enum AudioQueueParameter : uint // UInt32 AudioQueueParameterID
Expand All @@ -303,7 +303,7 @@ public enum AudioQueueDeviceProperty { // UInt32 AudioQueueParameterID
/// <summary>To be added.</summary>
SampleRate = 0x61717372,
/// <summary>To be added.</summary>
NumberChannels = 0x61716463
NumberChannels = 0x61716463,
}

[Flags]
Expand Down Expand Up @@ -1779,7 +1779,7 @@ public unsafe AudioQueueStatus RenderOffline (double timeStamp, AudioQueueBuffer

var stamp = new AudioTimeStamp () {
SampleTime = timeStamp,
Flags = AudioTimeStamp.AtsFlags.SampleTimeValid
Flags = AudioTimeStamp.AtsFlags.SampleTimeValid,
};
return AudioQueueOfflineRender (handle, &stamp, audioQueueBuffer, frameCount);
}
Expand Down
2 changes: 1 addition & 1 deletion src/AudioToolbox/AudioServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public enum AudioServicesError { // Implictly cast to OSType
enum AudioServicesPropertyKey : uint // UInt32 AudioServicesPropertyID
{
IsUISound = 0x69737569, // 'isui'
CompletePlaybackIfAppDies = 0x69666469 // 'ifdi'
CompletePlaybackIfAppDies = 0x69666469, // 'ifdi'
}

static class AudioServices {
Expand Down
6 changes: 3 additions & 3 deletions src/AudioToolbox/AudioSessions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public enum AudioSessionCategory { // UInt32 AudioSessionPropertyID
/// <summary>
/// Use this category when you want to use the hardware accelerated audio support to perform audio conversions.
/// </summary>
AudioProcessing = 0x70726f63 // 'proc'
AudioProcessing = 0x70726f63, // 'proc'
}

/// <summary>Possible values to override the audio route</summary>
Expand Down Expand Up @@ -126,7 +126,7 @@ public enum AudioSessionRouteChangeReason { // UInt32 AudioSessionPropertyID
/// <summary>There is no audio device for the current set category in the audio session. For example, recording when there is no microphone available.</summary>
NoSuitableRouteForCategory = 7,
/// <summary>To be added.</summary>
RouteConfigurationChange = 8
RouteConfigurationChange = 8,
}

/// <summary>An enumeration whose values indicate whether the application should resume after an interruption. Returned by the <see cref="P:AudioToolbox.AudioSession.InterruptionType" /> property.</summary>
Expand Down Expand Up @@ -248,7 +248,7 @@ public enum AudioSessionMode { // UInt32 AudioSessionPropertyID
public enum AudioSessionActiveFlags : uint // UInt32 in AudioSessionSetActiveWithFlags
{
/// <summary>If this value is set, the operating system might notify and resume background applications that were playing audio back.</summary>
NotifyOthersOnDeactivation = (1 << 0)
NotifyOthersOnDeactivation = (1 << 0),
}

/// <summary>The available audio input sources on the device.</summary>
Expand Down
Loading

8 comments on commit ad03dc9

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.