realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.64k stars 2.22k forks source link

About glob recursive #3789

Closed funzin closed 2 years ago

funzin commented 2 years ago

New Issue Checklist

New rule request

Now, swiftlint uses glob library in libc. https://github.com/realm/SwiftLint/blob/86b6392aa22bb4b91a8f033d4dd11c8e4ab87b8f/Source/SwiftLintFramework/Helpers/Glob.swift#L8

But the library doesn’t support about recursive unlike python glob module. (ref: https://docs.python.org/3/library/glob.html) Here is an example of a recursive search

e.g.
Tmp/Tmp1.swift
Tmp/Tmp2/Tmp1.swift

pattern: Tmp/**/Tmp1.swift

Desirable Result✌️
Tmp/Tmp1.swift
Tmp/Tmp2/Tmp1.swift

Actual Result🥲
Tmp/Tmp2/Tmp1.swift

I would like to introduce recursive search in excluded & included options. I think that glob logic can be replaced in Globs.swift in SwiftFormat

What do you think about replacing glob logic? If possible, I would like to hear your opinion & discuss.

jpsim commented 2 years ago

I'm up for it. Pathos appears to have support for recursive globs, so perhaps we could use that as well.

funzin commented 2 years ago

I'm up for it. Pathos appears to have support for recursive globs, so perhaps we could use that as well.

@jpsim

Thank you for your reply. I will check Pathos later and then if I have time, I will create PR which replace glob recursive from the original to Pathos :+1: