Skip to content

sorted_imports rule rewrite doesn't handle access level well #6374

Closed

Description

@Brett-Best

New Issue Checklist

Bug Description

In the process of upgrading SwiftLint to the latest version, prior to the rewrite of the sorted_imports rule the following passed:

Example 1

BEFORE

public import SharedDomain
@_private(sourceFile: "GeneratedStringsSymbols_BrandA.swift")
import StringsBrandA
import SwiftUI

AFTER

@_private(sourceFile: "GeneratedStringsSymbols_BrandA.swift")
import StringsBrandA
public import SharedDomain
import SwiftUI

Example 2

BEFORE

public import A
public import C
import B
import D

AFTER

public import A
import B
public import C
import D

I'm unsure if this is intentional or not, if yes, maybe a configuration could be added?

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

$ swiftlint lint --fix

Environment

  • SwiftLint version (run swiftlint version to be sure) 0.62.2
  • Xcode version (run xcodebuild -version to be sure) 26.1.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc) SwiftPM Binary Target
  • Configuration file:
sorted_imports:
  grouping: attributes

opt_in_rules:
  - sorted_imports

Are you using nested configurations? No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions