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

Feature/support for excluding with glob #1712

Closed
wants to merge 8 commits into from
Closed

Feature/support for excluding with glob #1712

wants to merge 8 commits into from

Conversation

xzeror
Copy link

@xzeror xzeror commented Jul 26, 2017

Addressing issue #1220. Added support for excluding files using globs.
For example, if you want to exclude all test files in project you can add following line into your .swiftlint.yml:

excluded:
  - ./**/*Test?.swift

@SwiftLintBot
Copy link

SwiftLintBot commented Jul 26, 2017

2 Errors
🚫 Please rebase to get rid of the merge commits in this PR
🚫 Could not build branch
1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@jpsim
Copy link
Collaborator

jpsim commented Jul 26, 2017

Thanks for your work on this! A few thoughts:

  1. If we support globbing in one place where we take paths, we should support it everywhere we take paths. This includes the included configuration key, maybe other places too, you'll have to look to determine where else it might apply.
  2. We don't often add external dependencies to SwiftLint, and doing so should be weighed very carefully. In this case, I have a few concerns:
    1. The dependency is a fork of another project. Is the fork the canonical version of the project? If not, why is the original project not being used?
    2. What signs are there that we can rely on this being actively maintained? Both the fork and the original repo have 0-5 GitHub stars and I can't find any other projects using them.
    3. Tests appear to be minimal, but at least there are some.
    4. What alternatives do we have? Is there a well-regarded C-library that we could wrap in a Swift API?

@codecov-io
Copy link

codecov-io commented Jul 27, 2017

Codecov Report

Merging #1712 into master will increase coverage by 0.22%.
The diff coverage is 91.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1712      +/-   ##
==========================================
+ Coverage   87.61%   87.83%   +0.22%     
==========================================
  Files         214      220       +6     
  Lines       10534    10848     +314     
==========================================
+ Hits         9229     9528     +299     
- Misses       1305     1320      +15
Impacted Files Coverage Δ
...iftLintFramework/Extensions/String+SwiftLint.swift 69.64% <100%> (+6.67%) ⬆️
.../SwiftLintFrameworkTests/Glob+SwiftLintTests.swift 100% <100%> (ø)
...Framework/Extensions/NSFileManager+SwiftLint.swift 81.81% <100%> (+11.22%) ⬆️
...ework/Extensions/Configuration+LintableFiles.swift 83.33% <100%> (-1.29%) ⬇️
Carthage/Checkouts/Glob/Sources/Glob.swift 88.49% <88.49%> (ø)
Source/SwiftLintFramework/Rules/CustomRules.swift 94.82% <0%> (-3.45%) ⬇️
...s/SwiftLintFrameworkTests/ConfigurationTests.swift 91.97% <0%> (-2.82%) ⬇️
.../SwiftLintFrameworkTests/SourceKitCrashTests.swift 81.35% <0%> (-0.62%) ⬇️
Tests/SwiftLintFrameworkTests/RulesTests.swift 100% <0%> (ø) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bfad6c...22d5188. Read the comment docs.

@xzeror
Copy link
Author

xzeror commented Jul 27, 2017

Hi.

  1. I thought about it. Supporting globs in all places could be done later. This PR resolves original ticket and common problem of excluding test files from SwiftLint when they lay in the same place with code. It would be really great if we can ship this MVP to users.
  2. Yeah. Adding it as dependency was not easy =)
    i. Original project could not be used because the author doesn't want to add Carthage and CocoaPods support. You could read our discussion here
    ii. I maintain my fork at the moment and expect to do so in the future.
    iii. I'll try to add some tests. What target coverage should I achieve?
    iv. Glob is lightweight wrapper around glob stdlib call already. Should we search for another more lightweight library? I don't think so. Should we use direct stdlib call in SwiftLInt? No. We will need wrapper around it to abstract C structures. Should we incorporate Glob.swift into SwiftLint directly? Maybe. That should be maintainers decision.

@xzeror
Copy link
Author

xzeror commented Aug 9, 2017

@jpsim could you review my recent changes please?

@shyambhat
Copy link

Is there anything I can do to help push this PR forward?

I have no idea what Glob is, but I really think the ability to exclude files with a regex is invaluable.
We integrated SwiftLint into a five year old codebase and it's been almost a week that we've been fixing existing lint warnings. The hundreds of test files in the project are placed in the same hierarchy as the code being tested and having regexes to exclude these files will save us probably another week of fixing warnings.

@tschob
Copy link

tschob commented Nov 18, 2017

Are there any plans to continue or replace this PR?

@jpsim
Copy link
Collaborator

jpsim commented Nov 29, 2017

If this is to be considered, the next steps are to rebase the PR (no merge commits please) and have it pass all CI checks.

@norio-nomura
Copy link
Collaborator

Carthage/Checkouts/Glob should be submodule instead of embedding.

@keith
Copy link
Collaborator

keith commented Jul 24, 2018

I've implemented an alternative to this here: #2316

@keith
Copy link
Collaborator

keith commented Aug 2, 2018

This has been merged in #2316 and is part of 0.27.0. I think we can close this PR

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

Successfully merging this pull request may close these issues.

9 participants