Questions tagged [swiftlint]

A tool to enforce Swift style and conventions, loosely based on GitHub's Swift Style Guide. SwiftLint hooks into Clang and SourceKit to use the AST representation of your source files for more accurate results.

A tool to enforce Swift style and conventions, loosely based on GitHub's Swift Style Guide. SwiftLint hooks into Clang and SourceKit to use the AST representation of your source files for more accurate results.

The tool verifies that your Swift code conforms to a set of rules syntactic rules defined by you and your teammates.

More details at SwiftLint Github.

185 questions
1
vote
1 answer

Disable SwiftLint multiline_arguments on some of the methods globally

Is there a possibility to disable multiline_arguments rule only on some of the classes/methods? I could write // swiftlint:disable multiline_arguments someMethod(self, a: a, b: b c: c) // swiftlint:enable multiline_arguments But then I would have…
Jaroslav
  • 1,389
  • 14
  • 27
1
vote
1 answer

How to use specific .swiftlint.yml?? swiftlint is hiting it is on root path.

How to use specific .swiftlint.yml?? swiftlint is hiting it is on root path. Even I put another .swiftlint.yml in child path. I can see below description on swiftlint github. Each file will be linted using the configuration file that is in its…
Jinho
  • 11
  • 1
  • 2
1
vote
0 answers

SwiftLint extension for Xcode 10

I want add swiftLint for Xcode to extensions and according to this install instructions, first step I have to do is to go to terminal and write: sudo /usr/libexec/xpccachectl and I got: sudo: /usr/libexec/xpccachectl: command not found So I can't…
wm.p1us
  • 2,019
  • 2
  • 27
  • 38
1
vote
2 answers

Error when run pod install after add swiftLint to project

Long story short I'm trying to add SwiftLint into my project using cocoapods, but after I add the run script, I'm unable to perform pod install and pod update without error. Every time that I execute pod install I get the…
FilipeFaria
  • 639
  • 1
  • 10
  • 16
1
vote
0 answers

Custom Swiftlint rule to make Xcode warnings like depreciations as error

My project do have around 3000 warnings, and my motive is to make our Xcode project warning free. I just started using swiftLint, As string.characters.count is depreciated, I wants to make each depreciation an error but step by step. I want to make…
1
vote
1 answer

Match "com.project.name" but not when it contains something else

I have the following code: var i = "test" and var i = "com.project.name.test" print("something else") fatalError("some error") I have a regex: "((?!com\.project\.name).)*" to match any string that does NOT contain "com.project.name". However, I…
Brandon
  • 22,723
  • 11
  • 93
  • 186
1
vote
2 answers

Regex for SwiftLint custom rule not matching

I've created regex to determine if a class has an empty line following it. When searching in xcode, this works perfectly. However, swiftlint does not seem to work properly. Rule is: custom_rules: space_after_class: name: "No Space After…
Bryan V
  • 537
  • 7
  • 16
1
vote
2 answers

Adding SwiftLint as a Dependency to a Podspec Project

I'm fairly new to Cocoapods, and I'm hoping this is a question easily answered by 'RTFM', but the 'M' provided by Cocoapods doesn't seem to answer my question. I'm applying SwiftLint to my projects. I can easily add it to my projects that include…
Chris Marshall
  • 4,910
  • 8
  • 47
  • 72
1
vote
1 answer

How to identify if the error/warning is created with swiftlint rules

I am working on CI/CD setup for my xcode project. For code analysis i am using swiftlint. It is working fine and i am able to see all the errors and warnings in my xcode along with the description. I have also written the run script such that…
Vidhya Sri
  • 1,773
  • 1
  • 17
  • 46
1
vote
1 answer

How should I fix the errors in Nimble files?

I'm attempting to use the Quick/Nimble testing framework in the iOS application at work. When I build my xcworkspace project I get all the errors in the image below. All these errors are within the Pods.xcodeproj in Pods/Nimble folder. I'm using…
ltrainpr
  • 3,115
  • 3
  • 29
  • 40
1
vote
1 answer

Xcode share run script build phase between projects in a workspace

Is there a way in Xcode to share a run script build phase across multiple projects in a workspace? I am using SwiftLint to enforce coding styles, but I don't want to manually add the necessary run script to all of the projects (that I maintain, not…
Adam Johns
  • 35,397
  • 25
  • 123
  • 176
1
vote
1 answer

Attributes in SwiftLint custom regex-based rules

I am creating custom rule for SwiftLint that checks the spelling of color. I need this to be case insensitive. I am currently matching using regex: "([C|c]olour)" but I would like to use the case insensitive modifier /i. I have tried the following…
user4481037
0
votes
0 answers

SwiftLint native rule with custom path

How can I apply the native file_name SwiftLint rule specifically to test files (files ending with test or tests in their name)?
Soheil Novinfard
  • 1,358
  • 1
  • 16
  • 43
0
votes
0 answers

Swiftlint parent directory

I have a swift package which I am using in some of my projects. I just added a dev app to my package folder to quickly preview and add some of the swiftUI code in it. The structure is like so: Package-root-folder ..Package.swift, ..Sources,…
beowulf
  • 546
  • 1
  • 10
  • 16
0
votes
1 answer

How to add SwiftLint to Swift Vapor project

I'm trying to add SwiftLint to my Swift Vapor project but had no luck figuring out these errors. Full Package.swift code: import PackageDescription let package = Package( name: "VaporApp", platforms: [ .macOS(.v10_15) ], …
Wendell
  • 474
  • 3
  • 12