Repository: apple/swift-nio
File: Sources/NIOFileSystem/FileInfo.swift (Swift)

Code before:
    /// The numeric ID of a group.
    public struct GroupID: Hashable, Sendable, CustomStringConvertible {
        public var rawValue: UInt32

        public init(rawValue: UInt32) {
            self.rawValue = rawValue
        }

        public var description: String {
            String(describing: self.rawValue)
        }
    }

    /// A time interval consisting of whole seconds and nanoseconds.
    public struct Timespec: Hashable, Sendable {
        #if canImport(Darwin)
        private static let UTIME_OMIT_INT = Int(UTIME_OMIT)
        private static let UTIME_NOW_INT = Int(UTIME_NOW)
        #elseif canImport(Glibc) || canImport(Musl)
        private static let UTIME_OMIT_INT = Int(CNIOLinux_UTIME_OMIT)
        private static let UTIME_NOW_INT = Int(CNIOLinux_UTIME_NOW)
        #endif

        /// A timespec where the seconds are set to zero and the nanoseconds set to `UTIME_OMIT`.
        /// In syscalls such as `futimens`, this means the time component set to this value will be ignored.
        public static var omit = Self.init(
            seconds: 0,
            nanoseconds: Self.UTIME_OMIT_INT
        )

        /// A timespec where the seconds are set to zero and the nanoseconds set to `UTIME_NOW`.
        /// In syscalls such as `futimens`, this means the time component set to this value will be
        /// be set to the current time or the largest value supported by the platform, whichever is smaller.
        public static var now = Self.init(
            seconds: 0,
            nanoseconds: Self.UTIME_NOW_INT
        )

        /// The number of seconds.
        public var seconds: Int

        /// The number of nanoseconds.
        public var nanoseconds: Int

        init(_ timespec: timespec) {
            self.seconds = timespec.tv_sec
            self.nanoseconds = timespec.tv_nsec
        }

        public init(seconds: Int, nanoseconds: Int) {
            self.seconds = seconds

Review comment (suggestion):
🚨 `public static var` alert! 🚨

This should either be a `let` or a computed property. Same goes for `now`.

Code after:
    /// The numeric ID of a group.
    public struct GroupID: Hashable, Sendable, CustomStringConvertible {
        public var rawValue: UInt32

        public init(rawValue: UInt32) {
            self.rawValue = rawValue
        }

        public var description: String {
            String(describing: self.rawValue)
        }
    }

    /// A time interval consisting of whole seconds and nanoseconds.
    public struct Timespec: Hashable, Sendable {
        #if canImport(Darwin)
        private static let utimeOmit = Int(UTIME_OMIT)
        private static let utimeNow = Int(UTIME_NOW)
        #elseif canImport(Glibc) || canImport(Musl)
        private static let utimeOmit = Int(CNIOLinux_UTIME_OMIT)
        private static let utimeNow = Int(CNIOLinux_UTIME_NOW)
        #endif

        /// A timespec where the seconds are set to zero and the nanoseconds set to `UTIME_OMIT`.
        /// In syscalls such as `futimens`, this means the time component set to this value will be ignored.
        public static let omit = Self(
            seconds: 0,
            nanoseconds: Self.utimeOmit
        )

        /// A timespec where the seconds are set to zero and the nanoseconds set to `UTIME_NOW`.
        /// In syscalls such as `futimens`, this means the time component set to this value will be
        /// be set to the current time or the largest value supported by the platform, whichever is smaller.
        public static let now = Self(
            seconds: 0,
            nanoseconds: Self.utimeNow
        )

        /// The number of seconds.
        public var seconds: Int

        /// The number of nanoseconds.
        public var nanoseconds: Int

        init(_ timespec: timespec) {
            self.seconds = timespec.tv_sec
            self.nanoseconds = timespec.tv_nsec
        }

        public init(seconds: Int, nanoseconds: Int) {
            self.seconds = seconds