Comments (4)
It still happens.
What I noticed is when I start the project and it does an initial lint, it picks up all the problems correctly.
Looks like it may be using the default config sitting in the project root.
But as soon as I navigate into the specific file it seems to re-run SwiftLint this time with different configs (or without them?).
Is there a way I could configure extension to print verbose output somewhere to see what commands it invokes when I navigate between files?
from vscode-swiftlint.
As far as I could track it down when listing the entire workspace the extension passes the project root path to SwiftLint, which allows SwiftLint to find parent/child config files.
When going into an editor window it ends up using --use-stdin
flag with current working directory set to the parent directory of the currently opened file. It also passes the whole file via stdin.
E.g. something like this:
cd sub/dir
cat file.swift | swiftlint --use-stdin
I suspect it's intended behavior of SwiftLint.
When we pass it Swift code via stdin it shouldn't really care what's the current working directory. We don't pass it any actual path to figure out where to look for config file either.
I understand that extension wants to pass file content rather than the file to have an option to lint currently selected text vs the whole file.
Maybe there's some magic the extension could add?
E.g. look up for for first .swiftlint.yml
in parent directories within the workspace.
Or maybe always run swiftlint
command passing the file path.
from vscode-swiftlint.
Hey @mgrebenets!
Thanks for the great issue description!
In theory 1.4.0 and #23 should've added nested config support if swiftlint.configSearchPaths
is empty. But I still found the outdated default value [".swiftlint.yml"]
within the code base.
Does 1.4.3 fix your issue?
from vscode-swiftlint.
I can't thank you enough! I actually wrote multiple comments just to delete everything before sending. I always found a new edge case.
When running swiftlint --use-stdin
we'd need to get into the current file's parent directory which contains the most specific .swiftlint.yml
-file and then lint. This would lead to mostly correct results.
But this would break the behaviour of excluded
! And even explicitly passing --config
stops nested configurations from working correctly (and I try to avoid parsing all configs).
Instead I decided to only lint files after being saved. Currently it is only possible to view the actually executed commands by cloning this repo and starting the debugger. In the case of this issue the executed command would look something like:
cd /Users/vknabel/Desktop/Swiftlint && SCRIPT_INPUT_FILE_0='dir/dir/Example.swift' SCRIPT_INPUT_FILE_COUNT='1' '/usr/local/bin/swiftlint' '--use-script-input-files' '--quiet' '--reporter' 'json'
The new behaviour is available as 1.4.4. Can you test the new release?
In the mid to long term, I try to re-add the lint-while-typing-feature. But I guess this takes a little bit more work.
from vscode-swiftlint.
Related Issues (20)
- Report Illegal argument: line must be non-negative HOT 2
- Report Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonSourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading libsourcekitdInProc.so failed HOT 1
- Report 1 Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonError: No lintable files found at paths: '' HOT 1
- レポートコマンドに失敗しました: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonSourceKittenFramework/File.swift:20: 致命的なエラー: 'try!'式は予期せずエラーを発生させた: Error Domain=NSCocoaErrorDomain Code=260 「そのようなファイルがないため、ファイル「DKAssetGroupDetailImageCell.swift」を開けませんでした。」UserInfo={NSFilePath=/Users/ir/Desktop/Sense0.0/sense_0/ios/Pods/DKImagePickerController/Sources/DKImagePickerController/View/Cell/DKAssetGroupDetailImageCell.swift, NSUnderlyingError=0x133f616b0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}https://github.com/llvm/llvm-project/issues/にバグレポートを提出し、クラッシュバックトレースを含めてください。 HOT 1
- The default swiftlint.path value is invalid on Windows HOT 14
- Report 1 Command failed: swiftlint lint --quiet --reporter jsonError: No lintable files found at paths: '' HOT 1
- Report Command failed: /opt/homebrew/bin/swiftlint /usr/bin/env swiftlint lint --quiet --reporter jsonwarning: Configuration contains invalid keys identation.SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=261 "The file “env” couldn’t be opened using text encoding Unicode (UTF-8)." UserInfo={NSFilePath=/usr/bin/env, NSStringEncoding=4}PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. HOT 1
- Report Command failed: /usr/bin/env swiftlint lint --quiet --reporter jsonSourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “SerialExecutorTests.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/MyUser/Development/Vapor/MyProject/.build/checkouts/swift-nio/Tests/NIOPosixTests/SerialExecutorTests.swift, NSUnderlyingError=0x13898b600 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} HOT 1
- Report Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonwarning: Found a configuration for 'type_body_length' rule, but it is disabled on 'disabled_rules'.SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “Color Extension.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/user/Development/Git/app/Color Extension.swift, NSUnderlyingError=0x7ff5c571c650 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} HOT 1
- Report Command failed: /opt/homebrew/bin/swiftlint /usr/bin/env swiftlint lint --quiet --reporter jsonwarning: Invalid configuration for 'trailing_whitespace'. Falling back to default.warning: Invalid configuration for 'indentation'. Falling back to default.SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=261 "The file “env” couldn’t be opened using text encoding Unicode (UTF-8)." UserInfo={NSFilePath=/usr/bin/env, NSStringEncoding=4}PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. HOT 1
- Report 1 Command failed: swiftlint lint --quiet --reporter jsonError: No lintable files found at paths: ''
- Report 1 Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonError: No lintable files found at paths: '' HOT 2
- add Windows support HOT 1
- Report 1 Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonError: No lintable files found at paths: '' HOT 1
- Report 1 Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonError: No lintable files found at paths: ''
- Report 1 Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonError: No lintable files found at paths: ''
- Support `source.fixAll.swiftlint`
- onlyEnableWithConfig confusion
- Report 1 Command failed: /usr/bin/env swiftlint lint --use-script-input-files --quiet --reporter jsonError: No lintable files found at paths: ''
- Report Command failed: /home//SDKs/Swift/swift-tools/SwiftLint/.build/release/swiftlint lint --quiet --reporter jsonSourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading libsourcekitdInProc.so failed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-swiftlint.