realm / realm/SwiftLint

child_config does not honor excluded files

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

Nobody has claimed this yet.

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

Description

New Issue Checklist
Describe the bug

After updating from 0.42.0 to 0.43.1 is not excluding files anymore that were set in child configs.

Complete output when running SwiftLint, including the stack trace and command used

0.42.0

Linting Swift files at paths /SwiftlintBug/WidgetExtension

Linting 'ValidFile.swift' (1/1)

Done linting! Found 0 violations, 0 serious in 1 file.
Linting Swift files at paths /SwiftlintBug/SwiftlintBug

Linting 'AppDelegate.swift' (1/3)
Linting 'SceneDelegate.swift' (2/3)
Linting 'ContentView.swift' (3/3)

Done linting! Found 0 violations, 0 serious in 3 files.

0.43.1


Linting Swift files at paths /SwiftlintBug/WidgetExtension

Linting 'ValidFile.swift' (1/2)
Linting 'WidgetExtension.swift' (2/2)
Done linting! Found 3 violations, 0 serious in 2 files.

/SwiftlintBug/WidgetExtension/WidgetExtension.swift:36:8: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)
/SwiftlintBug/WidgetExtension/WidgetExtension.swift:10:122: Void Return Violation: Prefer `-> Void` over `-> ()`. (void_return)
/SwiftlintBug/WidgetExtension/WidgetExtension.swift:15:126: Void Return Violation: Prefer `-> Void` over `-> ()`. (void_return)

Linting Swift files at paths /SwiftlintBug/SwiftlintBug

Linting 'TrailingWhitespaceFile.swift' (1/4)
Linting 'AppDelegate.swift' (2/4)
Linting 'SceneDelegate.swift' (3/4)
Linting 'ContentView.swift' (4/4)
Done linting! Found 1 violation, 0 serious in 4 files.

/SwiftlintBug/SwiftlintBug/TrailingWhitespaceFile.swift:6:1: Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

Run script's

Run script in SwiftlintBug target

${SRCROOT}/Pods/SwiftLint/swiftlint lint ${SRCROOT}/${TARGET_NAME}

Run script in WidgetExtension target

${SRCROOT}/Pods/SwiftLint/swiftlint lint ${SRCROOT}/${TARGET_NAME}
Environment
  • SwiftLint version (run swiftlint version to be sure)? 0.42.0 & 0.43.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
  • Paste your configuration file:

/SwiftlintBug/.swiftlint.yml

opt_in_rules:
   - operator_usage_whitespace

disabled_rules:
   - line_length

reporter: "xcode"

/SwiftlintBug/SwiftlintBug/.swiftlint.yml

parent_config: ../.swiftlint.yml

excluded:
   - TrailingWhitespaceFile.swift

/SwiftlintBug/WidgetExtension/.swiftlint.yml

parent_config: ../.swiftlint.yml

excluded:
   - WidgetExtension.swift
  • Which Xcode version are you using (check xcodebuild -version)?
    ** Xcode 12.5 Build version 12E262

I have attached a Xcode project to reproduce this issue SwiftlintBug.zip.

Don't forget to run pod install, build and check the project and then remove the specific version from the Podfile, run pod update and then build and check the project

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 issue using the root .swiftlint.yml and the child configs at SwiftLintBug/.swiftlint.yml and WidgetExtension/.swiftlint.yml, comparing the two SwiftLint versions with the provided run-script commands. Trace how each child config resolves its parent and excluded path; done means TrailingWhitespaceFile.swift and WidgetExtension.swift are omitted from linting as they were 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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.