Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
Swiftlint underscore name swift

I use swiftlint in my project. The project name is ABC xx and it works fine with swiftlint. Now I decided to include Unitest in my application and I have to import @testable import ABC_xx into the swift test file which is class ABC_xxTests: XCTestCase { not I get an error with Swiftlinter which says Type Name Violation: Type name should only contain alphanumeric characters: 'ABC_xxTests' (type_name) how do I sort this error

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

The following swiftlint rule enable the use of underscore in your Swift class names:

type_name:
  allowed_symbols: "_"

EDIT: If you want to enable the use of underscore also for variable names use:

identifier_name:
  allowed_symbols: "_"
over 4 years ago · Santiago Trujillo Report

0

In addition to @carmine's answer, keep the below two things in mind while adding attributes to any rule in .swiftlint.yml:

  • it should be listed in a new line
  • and should be preceded with a white space.

In my case I overlooked the white space before allowed_symbols. So the linting was not working. When I added white space, it was successful.

over 4 years ago · Santiago Trujillo Report

0

You can disable rule for specified folder, in your case its an ABC_xxTests folder. Inside .swiftlint.yml configuration file you can use 'excluded' property. If you haven't yet create swiftlint configuration file, you can create one with name .swiftlint.yml and place it in your project root folder.

Add this lines:

excluded:
    - ABC_xxTests
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!