Skip to content

False positive with file_header #6227

@jrpinteno

Description

@jrpinteno

New Issue Checklist

Bug Description

Using file_header with a configured pattern triggers violation. This appeared after upgrading to 0.60.0 (it worked fine with 0.59.1 and previous versions).

// This triggers a violation:

//
//  Test.swift
//  Dummy App
//
//  Created by Xavi R. Pinteño on 3.9.2025.
//  Copyright © 2025 Dummy Corporation. All rights reserved.
//

enum Test {
}

Mention the command or other SwiftLint integration method that caused the issue. Include stack traces or command output.

$ swiftlint lint Test.swift

Environment

  • SwiftLint version 0.60.0
  • Xcode version 16.4. Build version 16F6
  • Installation method used: Homebrew
  • Configuration file:
opt_in_rules:
  - file_header

file_header:
  required_pattern: |
                    \/\/
                    \/\/  SWIFTLINT_CURRENT_FILENAME
                    \/\/  .*?
                    \/\/
                    \/\/  Created by .*? on \d{1,2}[\.\/]\d{1,2}[\.\/]\d{2,4}\.
                    \/\/  Copyright © \d{4} Dummy Corporation\. All rights reserved\.
                    \/\/
  • Nested configurations: No

Metadata

Metadata

Assignees

Labels

bugUnexpected and reproducible misbehavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions