realm / realm/SwiftLint

Relative excluded path in a nested configuration is ignored

Open
#3,564 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

New Issue Checklist
Describe the bug

When a relative excluded path is present in a nested configuration it is ignored in SwiftLint 0.43.0 . If I try to run SwiftLint 0.42.0 in the same setup it works fine.
It may be related to #3557 . But that issue mentions the case without any nested configurations.

Complete output when running SwiftLint, including the stack trace and command used
❯ swiftlint version
0.43.0

~/work/test
❯ swiftlint
Linting Swift files in current working directory
Linting 'test.swift' (1/1)
/Users/asolovev/work/test/A/B/test.swift:1:1: warning: Identifier Name Violation: Variable name should be between 10 and 40 characters long: 'abcd' (identifier_name)
Done linting! Found 1 violation, 0 serious in 1 file.
~/work/test
❯ mint run swiftlint@0.42.0
Linting Swift files in current working directory
Done linting! Found 0 violations, 0 serious in 0 files.
Environment
  • SwiftLint version (run swiftlint version to be sure)?
    0.43.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    Mint. The same happens when using mint run and when using a 0.43.0 version linked to /usr/local/bin
  • Paste your configuration file:

./.swiftlint.yml

identifier_name:
  min_length: 10

./A/.swiftlint.yml

excluded:
 - B

❯ find .
.
./.swiftlint.yml
./A
./A/.swiftlint.yml
./A/B
./A/B/test.swift

Configurations are mentioned above
./A/B/test.swift

let abcd = 10

  • Which Xcode version are you using (check xcodebuild -version)?
    Xcode 12.4
    Build version 12D4e
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.

It is a nested configuration issue, but it can be reproduced with data I mentioned before

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

Reproduce the nested setup with .swiftlint.yml, A/.swiftlint.yml, A/B/test.swift, and SwiftLint 0.43.0, then compare it with 0.42.0 using the listed commands. Trace how the nested configuration resolves the relative excluded path B; done means linting A/B/test.swift reports no violations as it does in 0.42.0.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.