realm / realm/SwiftLint

How to use swiftlint analyze? And `swiftlint analyze` reports extra warnings beyond `analyzer_rules` configuration.

Open
#6,199 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

Problem

In my .swiftlint.yml file, I only set the analyzer rule:

analyzer_rules:
- explicit_self

I run code analysis with the following commands:

xcodebuild -workspace XXX.xcworkspace \
                    -scheme XXX \
                    -destination 'id=CF68E389-C815-4918-B133-BE4839938B6F' \
                    clean build | tee xcodebuild-build.log

swiftlint analyze --compiler-log-path xcodebuild-build.log

However, the results contain not only explicit_self issues, but also other warnings such as:

value was defined but never used

These extra warnings seem to come from the Xcode build result itself, but I expected swiftlint analyze to only report issues from analyzer_rules.

Question
  1. How can I make swiftlint analyze report only issues defined in analyzer_rules?
  2. Are there more examples or best practices for using swiftlint analyze? Documentation is very limited.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented swiftlint analyze --compiler-log-path workflow and the .swiftlint.yml analyzer_rules configuration described in the issue. Clarify how build-log warnings relate to configured analyzer rules, then add usage examples and best practices; done means the two questions are answered in the documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.