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

Integrate SwiftLint with Swift package

I created a Swift Package and would like to integrate SwiftLint with that package. since there is no ".xcodeproj" is any other option available? FYI, I use the code for iOS platform Thank you,
Cam
  • 275
  • 6
  • 24
1
vote
1 answer

How can I turn off line length violations for an entire project when using SwiftLint

I just installed swiftlint and after running it, a lot of my warnings and errors are line length violations. I don't particularly care for how long my lines are. I'm just using SwiftLint to remove more important errors. Now to be clear, I know I can…
Arnav Motwani
  • 707
  • 7
  • 26
1
vote
0 answers

swift-lint: appeared errors that are not in the .swiftlint.yml file

I started to work with SwiftLint in my project (version 0.41.0). I wrote rules in .swiftlint.yml file and tried to run the project but the project is not builded due to error that not even in the .swiftlint.yml. for example I have Line Length…
Mor Goren
  • 105
  • 9
1
vote
0 answers

SwiftLint warning: Configuration contains invalid keys: ["function_level"]

Jus updated pods and getting warning warning: Configuration contains invalid keys: ["function_level"] changed .swiftlint.yml according to CHANGELOG inside: .swiftlint.yml colon: severity: error line_length: ignores_comments: true warning:…
Hattori Hanzō
  • 2,349
  • 4
  • 19
  • 36
1
vote
0 answers

Regex matches must be between another match

I would like to match different things, and add condition that these matches must be between specific boundaries, This is the text protocol SceneDisplayView { func displayEmailScreen() func displayPasswordScreen() func…
Osa
  • 1,922
  • 7
  • 30
  • 51
1
vote
0 answers

SwiftLint spacing counting into line_length

› let alert = UIAlertController(title: NSLocalizedString("Problem...", comment: ""), › message: NSLocalizedString("aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaa.",…
SRed
  • 185
  • 2
  • 12
1
vote
0 answers

SwiftLint suddenly stopped ignoring my Pods folder and it's giving errors

I'm working in a huge swift project. I'm testing DeviceKit pod from cocoapods, and worked perfectly until today. Even yesterday worked perfectly. Now, suddenly I can't compile because that class is giving me these kind of…
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
1
vote
1 answer

Why is SwiftLint whitelist_rules not working on my project?

I'm trying to configure swiftlint in my project and white_list is not working. Here is what I'm trying to do: my .swiftlint.yml: whitelist_rules: - force_cast: warning my code: let forceCast: Int = "hue" as! Int which gives me the error: Force…
Mik
  • 31
  • 3
1
vote
1 answer

SwiftLint cannot exclude the nested files

I try to exclude all the unit test files. But it does not work. Does SwiftLint support nested exclude? - Pods - Carthage - ".*Tests.swift" # Errors force_try: warning #All errors occur in Nimble pod, this can be ignored force_cast: severity:…
benoitcn
  • 149
  • 1
  • 12
1
vote
0 answers

SwiftLint Rule to ask for pragma mark before every extension

I'm trying to implement custom swiftlint rule to track when before "extension" there is no "// MARK: -". Here is my rule: custom_rules: pragma_mark: name: "Missing pagma mark" match_kinds: - comment -…
1
vote
1 answer

Custom rule for new line after/before MARK in SwiftLint

Could you help me? I want to write custom rule for SwiftLint. I would like to enforce putting one blank line before and after PRAGMA MARK: // Example: Error case some code\n // MARK - Smt\n some code\n Right case some code\n\n // MARK -…
1
vote
1 answer

swift-lint custom warning for UIWebview use

since apple is no longer supporting UIWebview, is it possible to have swift-lint warning for that. How to make a custom UIWebview usage swift-lint warning or error.
vijeesh
  • 1,317
  • 1
  • 17
  • 32
1
vote
1 answer

How to Write a Swift Function That Contains 2 Closures

I'm relatively new to Swift and am receiving a Multiple Closures with Trailing Closure Violation:... warning from SwiftLint. My code that causes this looks like: self.start(loggedIn: { _, error in //... // below line causes warning }) { [weak…
Stunner
  • 12,025
  • 12
  • 86
  • 145
1
vote
0 answers

Is it possible to do code analysis of an iOS framework?

I have a requirement where we need to perform code analysis to find vulnerabilities like how sonarqube does for an iOS Project, not for the actual swift files but for .framework created using the swift files. Is it possible to do this using…
Vidhya Sri
  • 1,773
  • 1
  • 17
  • 46
1
vote
1 answer

Git relative path issue - no lintable files found at paths

I have an iOS/Swift project under git version control system. Hierarchy is below, home/user/git_root/docs home/user/git_root/project home/user/git_root/project/project.xcodeproj As you see my git_root directory contains some other documents in docs…
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256