Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlwaysUseLowerCamelCase warning on tests #922

Open
AdamXA opened this issue Feb 5, 2025 · 1 comment
Open

AlwaysUseLowerCamelCase warning on tests #922

AdamXA opened this issue Feb 5, 2025 · 1 comment

Comments

@AdamXA
Copy link

AdamXA commented Feb 5, 2025

Running:
swift format lint --strict --configuration .swift-format --recursive .
returns the following:
MySubjectsClientTests.swift:7:16: warning: [AlwaysUseLowerCamelCase] rename the function 'getData_returnsMySubjectResponse_onSuccess' using lowerCamelCase

Documentation states that:

This rule does not apply to test code, defined as code which:

Contains the line import XCTest
The function is marked with @Test attribute

.swift-format

{
  "version": 1,
  "lineLength": 100,
  "indentation": {
    "spaces": 4
  },
  "maximumBlankLines": 1,
  "respectsExistingLineBreaks": true,
  "lineBreakBeforeControlFlowKeywords": true,
  "lineBreakBeforeEachArgument": true
}

MySubjectsClientTests.swift

import Foundation
import Testing

final class MySubjectsClientTests {
    @Test func getData_returnsMySubjectResponse_onSuccess() async throws {
// code removed
        #expect(true == true)
    }
}

also doesn't seem to recognise when import XCTest is present.

Seems fine with rules like NeverUseForceTry which also do not apply to test code.

Swift version 6.0.1 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
swift format -v main

@ahoppen
Copy link
Member

ahoppen commented Feb 5, 2025

Synced to Apple’s issue tracker as rdar://144224982

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants