Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.swiftlint.yml not always taken into account #1889

Closed
2 tasks done
vincentisambart opened this issue Oct 6, 2017 · 3 comments
Closed
2 tasks done

.swiftlint.yml not always taken into account #1889

vincentisambart opened this issue Oct 6, 2017 · 3 comments
Labels
wontfix Issues that became stale and were auto-closed by a bot.

Comments

@vincentisambart
Copy link

vincentisambart commented Oct 6, 2017

New Issue Checklist

Bug Report

Create the following 2 files in a subdirectory.

# subdir/.swiftlint.yml
disabled_rules:
  - todo
// subdir/MyCode.swift
// TODO: ABCDEFG

Specifying the path to the file causes the directory's .swiftlint.yml to be ignored.

$ swiftlint lint --no-cache --quiet # Not path specified, no warning as expected
$ swiftlint lint --no-cache --quiet --path subdir # Directory path specified, no warning
$ swiftlint lint --no-cache --quiet --path subdir/MyCode.swift # Specifying the file path gets you an unexpected warning
.../subdir/MyCode.swift:1:4: warning: Todo Violation: TODOs should be avoided (ABCDEFG). (todo)
$ swiftlint lint --no-cache --quiet --path $PWD/subdir/MyCode.swift # Same problem with the full path
.../subdir/MyCode.swift:1:4: warning: Todo Violation: TODOs should be avoided (ABCDEFG). (todo)

It seems to me that SwiftLint should automatically look if there is a .swiftlint.yml the directory the file is in, and then its parent directories.
Note if you are in the directory the file is in, no warning is displayed.

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    • 0.23.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    • HomeBrew
  • Are you using nested configurations?
    • No
  • Which Xcode version are you using?
    • 9.0
@SDGGiesbrecht
Copy link
Contributor

@vincentisambart, please see this comment. The issue may be slightly different, but the same advice applies.

(For the sake of GitHub’s indexing, I’ll add that this is issue is intrinsically related to #1825.)

@vincentisambart
Copy link
Author

@SDGGiesbrecht, I wouldn't have been surprised even if SwiftLint was looking for .swiftlint.yml up to the / root directory (starting from where the Swift file is).

What you name A) --subdirectory and B) --project would probably cover all my use cases (but I would need both).

@stale
Copy link

stale bot commented Nov 8, 2020

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!

@stale stale bot added the wontfix Issues that became stale and were auto-closed by a bot. label Nov 8, 2020
@stale stale bot closed this as completed Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix Issues that became stale and were auto-closed by a bot.
Projects
None yet
Development

No branches or pull requests

2 participants