Skip to content

AlwaysUseLowerCamelCase warning on tests #922

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

Closed
AdamXA opened this issue Feb 5, 2025 · 3 comments
Closed

AlwaysUseLowerCamelCase warning on tests #922

AdamXA opened this issue Feb 5, 2025 · 3 comments

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

@TTOzzi
Copy link
Member

TTOzzi commented Feb 20, 2025

This issue was resolved in #767, but the fix is not included in the latest release.
It will be available in a future 6.1 release.

@AdamXA
Copy link
Author

AdamXA commented Feb 20, 2025

Thank you

@AdamXA AdamXA closed this as completed Feb 20, 2025
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

3 participants