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
0
votes
1 answer

SwiftLint Rule for pragma mark

I'm trying to implement custom swiftlint rule to track when before "// MARK:" is less than two new lines. I'm not good in regex. Here is my rule: custom_rules: pragma_mark: name: "Wrong pagma mark format" regex: "([^\n\n]?\/\/ MARK:)" message:…
0
votes
0 answers

using swiftlint to enforce a unique coding guideline

I want to enforce the following coding guideline in a swift project All strings should be placed in the Strings file. We should NOT be hardcoding or storing any strings in the storyboard, xibs or classes. Is it possible to use swiftlint for the…
Moses Liao GZ
  • 1,556
  • 5
  • 20
  • 45
0
votes
0 answers

SwiftLint Returning Whitespace Violation

var completion: (()-> Void)? class func showView(inside view: UIView, with trophy: Trophy, completion:(()-> Void)? = nil) -> TrophyDetailsView { } I keep getting "Returning Whitespace Violation" in…
Monty
  • 341
  • 1
  • 4
  • 13
0
votes
1 answer

Dangerfile Swift Give File Name

I am currently integrating Danger into BuddyBuild so that it runs pre-build and post-build for me. I have two different Dangerfiles that I want to use. Buddybuild's website for integrating Danger says to run this line: bundle exec danger…
Logan
  • 1,172
  • 9
  • 23
0
votes
1 answer

Xcode autocorrection tool?

Are there any tool similar to swiftlint but with easy (15-30 minutes) way to auto correct violated rule? Scenario: "Rule - comment should have space and Capital letter in the beginning" Wrong line 1: "//line 1" Should be autocorrected to "// Line…
0
votes
1 answer

Keeping SwiftLint executable under source control

Is it a good practice to copy the SwiftLint executable to the project folder (under /support or something) and push it to git repo? Reason for this is that developers don't have to manually download and install SwiftLint in all computers and every…
flopr
  • 450
  • 4
  • 23
0
votes
1 answer

Illegal instruction: 4 "${PODS_ROOT}/SwiftLint/swiftlint"

When updating SwiftLint 0.16.1 to SwiftLint 0.18.1, I…
Cœur
  • 37,241
  • 25
  • 195
  • 267
0
votes
1 answer

Why does Swift lint ignore my custom regular expression?

My .swiftlint.yml file: disabled_rules: - trailing_whitespace - mark - line_length - force_cast - variable_name - force_try - cyclomatic_complexity - function_body_length - type_body_length - file_length -…
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
0
votes
0 answers

Error pod 'SwiftLint'

[!] /usr/bin/curl -f -L -o /var/folders/1x/jmv798095x1fbjc_6128mflh0000gn/T/d20170314-59599-7fjizg/file.zip https://github.com/realm/SwiftLint/releases/download/0.16.1/portable_swiftlint.zip --create-dirs --netrc % Total % Received % Xferd …
jhd
  • 1,243
  • 9
  • 21
0
votes
2 answers

How do I get recently added Swiftlint Rules

I have the latest version of Swiftlint (via brew). When I check github, I see that they have added a bunch of rules since the release, even a few a couple of days ago. How do I get those rules onto my mac? Do I have to uninstall the version I have…
Mozahler
  • 4,958
  • 6
  • 36
  • 56
0
votes
1 answer

Legacy Constant Violation for CGFloat(M_PI) * 2

For the following: struct Constants { static let m2Pi = CGFloat(M_PI) * 2 } SwiftLint 0.16.1 is warning me: warning: Legacy Constant Violation: Struct-scoped constants are preferred over legacy global constants. (legacy_constant) Note that I…
Cœur
  • 37,241
  • 25
  • 195
  • 267
0
votes
0 answers

Regex that matches strings that don't start or end with something

I am trying to write a swift lint rule that will ignore certain files in my project. Those files either start with Fake or end with Spec.swift. Example: Object.swift FakeObject.swift ObjectSpec.swift I only want the regex to match on…
Randall
  • 14,691
  • 7
  • 40
  • 60
0
votes
2 answers

Swiftlint output file I am not able to get

I am using Swiftlint CLI and it is running successfully and showing the quality issues in terminal.But their is no HTML file generating to see the output . Can anyone help how to get the output.
kiran
  • 49
  • 8
-1
votes
2 answers

At terminal print swiftlint information

After I installed swiftlint, I used the terminal to print the swiftlint information. When I printed the version number, it was correct. However, when I printed the rules, this problem occurred. mac: MacBook Pro(M1 chip) swift: 5.x Xcode:13.2
HR Jackson
  • 11
  • 5
-1
votes
1 answer

Is it possible to make fixable errors/warnings with SwiftLint?

I'm using SwiftLint to make custom errors and warnings and it's working well. However, I want to add a "fix" button to the warnings and errors just like with standard Xcode errors and warnings. Xcode already does this for the internal…
Akash Kundu
  • 1,278
  • 13
  • 21
1 2 3
12
13