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

Included path which include name of original directory are not included #3705

Closed
2 tasks done
Cronay opened this issue Sep 1, 2021 · 2 comments · Fixed by #4005
Closed
2 tasks done

Included path which include name of original directory are not included #3705

Cronay opened this issue Sep 1, 2021 · 2 comments · Fixed by #4005
Labels
bug Unexpected and reproducible misbehavior.

Comments

@Cronay
Copy link

Cronay commented Sep 1, 2021

New Issue Checklist

Describe the bug

I have two directories next to each other. The first directory contains a Xcode project on which swiftlint is supposed to be called on from the command line. In the other directory which has the same name as the first directory, just with a small addition to the name, has other Swift files which are also supposed to be linted. Due to the overlapping name the the second directory doesn't get scanned for files to be linted. When changing the name of the second directory to something that doesn't overlap with the first name running the same command the files from the second directory get detected.

An example of this can be found here: https://github.com/Cronay/swiftlint_name_collision

Swiftlint is supposed to be called within the 'samename' directory and the 'samenamexxx' directory also should be linted according to the .swiftlint.yml. Only when I change 'samenamexxx' to (for example) 'anotherdir' and also enter this in the config file then it get's scanned for swift files and those are linted.

Background is we have a real-world project at my company where we modularize our application via cocoapods and have the umbrella-app repository named 'ios-my-company-name' and all the other pod repos which are supposed to be linted we have named 'ios-my-company-name-core' or more generally 'ios-my-company-name-'. The reside next to each other in a directory and are included so we can import them as development pods via cocoapods. The linked repo above is just the minimal reproducable example I could find.

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

Linting Swift files in current working directory
Linting 'ViewController.swift' (1/2)
Linting 'AppDelegate.swift' (2/2)
/Users/yborgfeld/Desktop/Test/samename/LintingProject/ViewController.swift:26:1: warning: Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)
/Users/yborgfeld/Desktop/Test/samename/LintingProject/ViewController.swift:24:1: warning: Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)
/Users/yborgfeld/Desktop/Test/samename/LintingProject/AppDelegate.swift:26:1: warning: Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)
/Users/yborgfeld/Desktop/Test/samename/LintingProject/AppDelegate.swift:13:1: warning: Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)
/Users/yborgfeld/Desktop/Test/samename/LintingProject/AppDelegate.swift:15:1: warning: Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 4. (vertical_whitespace)
/Users/yborgfeld/Desktop/Test/samename/LintingProject/AppDelegate.swift:24:1: warning: Vertical Whitespace Violation: Limit vertical whitespace to a single empty line. Currently 2. (vertical_whitespace)
Done linting! Found 6 violations, 0 serious in 2 files.

Environment

  • SwiftLint version: 0.43.1
  • Installation method: Homebrew or CocoaPods (doesn't matter)
  • Paste your configuration file:
included:
  - ../samename
  - ../samenamexxx

Xcode Version: 12.5.1

Edit: This bug also occurs when only the second directory is in the included paths.

We found a workaround by passing the included directories via the command line and remove the 'included' section from the .swiftlint.yml file. Seems like this is only a bug with the yaml file.

@jpsim jpsim added the bug Unexpected and reproducible misbehavior. label Jan 20, 2022
@leon4app
Copy link

Meet the same problem.
But that is a bad news that --path only accept a single path as param(#3923)

@leon4app
Copy link

Meet the same problem. But that is a bad news that --path only accept a single path as param(#3923)

Calling swiftlint twice with different paths as params works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants