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

Exclude swift-testing macro (@Test) in identifier_name rules #6009

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

coffmark
Copy link
Contributor

Describe your changes

  • Exclude swift-testing macro (@Test) in identifier_name rules.
  • User can set excluded_swift_testing configuration as you needed.

Motivation

Normally functions should be implemented starting with a lowercase letter, but when using swift-testing, there're cases where you want to write test cases in the function name that aren't lowercase.

The following example is a Japanese implementation of a function named "This is a test".

This PR, using the excluded_swift_testing flag, allows user to prevent errors (or warnings) from occurring in functions with @Test macros implemented.

// before
@Test func これはテストです() { } // swiftlint error (`identifier_name`)  

// after (when `excluded_swift_testing` is true)
@Test func これはテストです() { } // no error

// after (when `excluded_swift_testing` is false)
@Test func これはテストです() { } // swiftlint error (`identifier_name`)  

Issue ticket number and link

None.

@SwiftLintBot
Copy link

SwiftLintBot commented Feb 25, 2025

18 Messages
📖 Building this branch resulted in a binary size of 29580.37 KiB vs 29580.32 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 1.78 s vs 0.94 s on main (89% slower).
📖 Linting Alamofire with this PR took 1.29 s vs 1.28 s on main (0% slower).
📖 Linting Brave with this PR took 8.54 s vs 8.51 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 5.78 s vs 5.79 s on main (0% faster).
📖 Linting Firefox with this PR took 11.77 s vs 11.77 s on main (0% slower).
📖 Linting Kickstarter with this PR took 9.86 s vs 9.9 s on main (0% faster).
📖 Linting Moya with this PR took 0.52 s vs 0.52 s on main (0% slower).
📖 Linting NetNewsWire with this PR took 2.87 s vs 2.89 s on main (0% faster).
📖 Linting Nimble with this PR took 0.77 s vs 0.78 s on main (1% faster).
📖 Linting PocketCasts with this PR took 8.7 s vs 8.7 s on main (0% slower).
📖 Linting Quick with this PR took 0.43 s vs 0.43 s on main (0% slower).
📖 Linting Realm with this PR took 4.54 s vs 4.52 s on main (0% slower).
📖 Linting Sourcery with this PR took 2.33 s vs 2.34 s on main (0% faster).
📖 Linting Swift with this PR took 4.76 s vs 4.77 s on main (0% faster).
📖 Linting VLC with this PR took 1.32 s vs 1.31 s on main (0% slower).
📖 Linting Wire with this PR took 18.84 s vs 18.69 s on main (0% slower).
📖 Linting WordPress with this PR took 11.36 s vs 11.38 s on main (0% faster).

Generated by 🚫 Danger

@coffmark coffmark force-pushed the feature/exclude-swift-testing-in-identifier-name branch from 278c846 to fb4955b Compare February 27, 2025 22:44
@coffmark coffmark force-pushed the feature/exclude-swift-testing-in-identifier-name branch from fb4955b to c2c4bbe Compare February 27, 2025 22:51
@coffmark coffmark force-pushed the feature/exclude-swift-testing-in-identifier-name branch from c2c4bbe to 5cf5580 Compare February 27, 2025 22:53
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

Successfully merging this pull request may close these issues.

2 participants