-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 only expects files with type ".swift" #1721
Comments
I’ve seen several issues where quick bug demonstrations were written as scripts like this:
Does it work to pipe your file to |
The standard way is to create the .lint-test file. I can override the
standard but it seems odd that you can't take any file
…On Fri, Jul 28, 2017, 4:14 PM Jeremy David Giesbrecht < ***@***.***> wrote:
I’ve seen several issues where quick bug demonstrations were written as
scripts like this:
echo "func doSomething() {}" | swiftlint lint --use-stdin
Does it work to pipe your file to swiftlint like that?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1721 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-K-xCr7BFeimux7CcL_NiZtei_TAuIks5sSXw2gaJpZM4OmIxR>
.
|
I don't think we should change the default behavior, but I think it'd be reasonable to offer a way to override it, perhaps in the configuration file. |
You guys are still not at 1.0, so you can do whatever you want haha.
Honestly I think specifying exact files is the way to go. Checking if
something is a swift file or not shouldn't be the job of the linter.
A good example is to simply pass globs to the ‘--path‘ variable. Something
like ‘--path **/*.swift‘.
…On Fri, Jul 28, 2017, 6:05 PM Marcelo Fabri ***@***.***> wrote:
I don't think we should change the default behavior, but I think it'd be
reasonable to offer a way to override it, perhaps in the configuration file.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1721 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-K-29EJN8XVM3tDvTmdBlqgRcrtHi3ks5sSZY5gaJpZM4OmIxR>
.
|
I disagree. I think the responsibility of a tool is to provide sensitive defaults. I wouldn't want that, by default, SwiftLint linted Objective-C files for example. Or that we needed to use
That could also work, but currently I don't think we even support passing a non-Swift file to |
If the path argument allowed non swift files and the default was all .swift
files I think that would work to both of our cases
…On Fri, Jul 28, 2017, 6:12 PM Marcelo Fabri ***@***.***> wrote:
Checking if
something is a swift file or not shouldn't be the job of the linter.
I disagree. I think the responsibility of a tool is to provide sensitive
defaults. I wouldn't want that, by default, SwiftLint linted Objective-C
files for example. Or that we needed to use --path all the times.
A good example is to simply pass globs to the --path variable. Something
like --path **/*.swift.
That could also work, but currently I don't think we even support passing
a non-Swift file to --path.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1721 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-K-3Ef1t-yVmvvDb50cC8NGB5NW-Vuks5sSZgCgaJpZM4OmIxR>
.
|
I do not understand what a I added Those files were the equivalent of SwiftLint’s
If the In case this is all a misunderstanding, you do know the normal way to use SwiftLint is to run |
ok I'll try an explain better. The arcanist test loader (for writing arcanist integration with swiftlint I might add) expects the test files to be ".lint-test" extension. This file is then separated into 2 parts, one which is the source and one which is the lint error. It's basically a generic way to test all linters effectively. Most linters allow the ability to specify a path and then to take any file at all. If no path is specified, then you can have sensible defaults such as linting the whole directory etc. There are 2 options, I can either change our generic test loader to make accomodations for swiftlint, which is the only linter which ignores a file even when explicitly pointed to. Simply allowing the |
So then the first and last lines here are running afoul of SwiftLint? I think it would be wiser if Arcanist’s test loader were to consistently append a meaningful file extension when it creates the temporary files to begin with, but that is just how I would do things. However, if you just want to get it working easily, I think you could just change line 67 from... $basename = basename($file); ...to... $basename = basename($file, ".lint-test"); ...based on this example. Then you just name your Swift test cases according to the pattern It looks to me like your existing test loader would then spit out temporary files with the |
I'll see what the arcanist maintainers say but its just surprising that swiftlint doesn't support exact file names. Ktlint, eslint, terraform lint, flake8, golint, pylint, rubylint, pep8, csslint, coffeelint, puppetlint, and rubocop all seem to be able to either specify the extension of the files they are looking for with sensible defaults or allow a direct file to be passed in. |
I really don't see why we wouldn't make SwiftLint work when passed single files to |
We definitely should change that check from |
I know that swiftlint explicitly expects files of type .swift, but I'd like to pass a file with ".lint-test" instead of ".swift". This is mainly for easy integration with https://github.com/phacility/arcanist.
The text was updated successfully, but these errors were encountered: