Giter Site home page Giter Site logo

vknabel / vscode-swiftlint Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 1.0 404 KB

VS Code extension to enforce Swift style and conventions via SwiftLint

Home Page: https://marketplace.visualstudio.com/items?itemName=vknabel.vscode-swiftlint

License: MIT License

TypeScript 99.93% Swift 0.07%
hacktoberfest linter swift swiftlint vscode vscode-extension

vscode-swiftlint's Introduction

vscode-swiftlint's People

Contributors

dependabot[bot] avatar tristanlabelle avatar vknabel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

felixlisczyk

vscode-swiftlint's Issues

Linux Support?

It's not documented whether or not it supports Linux. However, SwiftLint supports Linux so wondering if this does too.

Report Unexpected end of JSON input

SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at Object.<anonymous> (/home/xxx/.vscode/extensions/vknabel.vscode-swiftlint-1.0.3/out/lint.js:43:30) at Generator.next (<anonymous>) at fulfilled (/home/xxx/.vscode/extensions/vknabel.vscode-swiftlint-1.0.3/out/lint.js:5:58)

Report ERR_CHILD_PROCESS_STDIO_MAXBUFFER stdout maxBuffer length exceeded

RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded at Socket.onChildStdout (child_process.js:363:14) at Socket.emit (events.js:200:13) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:271:13) at Socket.Readable.push (_stream_readable.js:210:10) at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)

SwiftLint process doesn't terminate and consumes a lot of memory

As reported in realm/SwiftLint#3461, when using this extension with certain projects, it launches swiftlint processes in a way that don't terminate and consume a lot of memory. Here I attach a few screenshots from Activity Monitor that show that these processes consume tens of gigabytes of RAM and stay running for minutes. They also don't terminate after I close VSCode, and keep running, consuming 10-20% CPU load on average.

Screenshot 2020-12-09 at 21 56 37

Screenshot 2020-12-09 at 21 34 29

Nested configurations support

Hello!

SwiftLint supports nested configurations, for example you can have a top-level configuration in your root directory but define a different set of rules for use in a sub-directory.

As far as I can tell, this extension does not support nested configurations. A rule I have disabled in a sub-directory (but enabled in a top-level directory) incorrectly shows up in as a violation for files in the subdirectory.

It would be really nice to have support for this in the extension as right now I just have to ignore a bunch of violations in a directory.
However, I'm not exactly sure how one would add it, because as the linked README section notes it does not work when using the --config parameter which it looks like you use.

configSearchPaths setting is not respected

The extension seems to be always using the default SwiftLint ruleset and ignores the specified custom search path.

I have .swiftlint.yml file placed in my home directory and ~/.swiftlint.yml is added to "Config Search Paths" setting.

When I open a swift file in VSCode it is linted using the standard rules and not the ones in the config file.
Manually running swiftlint lint --config ~/.swiftlint.yml test.swift performs linting using custom rules as expected.

Report ERR_INVALID_ARG_VALUE The argument 'file' cannot be empty. Received ''

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received ''
	at normalizeSpawnArguments (child_process.js:423:11)
	at spawn (child_process.js:560:13)
	at Object.execFile (child_process.js:246:17)
	at Object.t.<computed> [as execFile] (electron/js2c/asar_bundle.js:5:2242)
	at Object.execShell (c:\Users\alexis.vidal\.vscode\extensions\vknabel.vscode-swiftlint-1.4.5\out\execShell.js:6:37)
	at c:\Users\alexis.vidal\.vscode\extensions\vknabel.vscode-swiftlint-1.4.5\out\lint.js:169:34
	at new Promise (<anonymous>)
	at execSwiftlint (c:\Users\alexis.vidal\.vscode\extensions\vknabel.vscode-swiftlint-1.4.5\out\lint.js:157:12)
	at Object.<anonymous> (c:\Users\alexis.vidal\.vscode\extensions\vknabel.vscode-swiftlint-1.4.5\out\lint.js:61:38)
	at Generator.next (<anonymous>)
	at fulfilled (c:\Users\alexis.vidal\.vscode\extensions\vknabel.vscode-swiftlint-1.4.5\out\lint.js:5:58)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
os: win32

SwiftLint reports issues for files that are in .git

I have run into the situation where swiftlint will warn me about issues that are about files that are in git and not in the active checked out code.

This issue can be recreated using the following steps:

  1. Create some swift code.
  2. Make certain there are a few swiftlint problems
  3. Check in with the swiftlint problems
  4. Fix the swiftlint problems so that swiftlint is silent
  5. Check source control in the left hand side
  6. Select the source that has been fixed but not check in yet
  7. VSCode will open the file in comparison mode. One of them will show the Working Tree
  8. At that moment swiftlint will start to report issues on the file that is currently in git

This is not a huge problem but it would be nice if swiftlint would ignore the Working Tree.

Report Command failed: /opt/homebrew/bin/swiftlint --use-script-input-files --quiet --reporter json --formatSourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “LogMsgTests.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/akash/Documents/projects/SwiftUI/Jupiter/Tests/JupiterTests/LogMsgTests.swift, NSUnderlyingError=0x11ee0b0a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

%60Error%3A%20Command%20failed%3A%20%2Fopt%2Fhomebrew%2Fbin%2Fswiftlint%20--use-script-input-files%20--quiet%20--reporter%20json%20--format%0ASourceKittenFramework%2FFile.swift%3A20%3A%20Fatal%20error%3A%20'try!'%20expression%20unexpectedly%20raised%20an%20error%3A%20Error%20Domain%3DNSCocoaErrorDomain%20Code%3D260%20%22The%20file%20%E2%80%9CLogMsgTests.swift%E2%80%9D%20couldn%E2%80%99t%20be%20opened%20because%20there%20is%20no%20such%20file.%22%20UserInfo%3D%7BNSFilePath%3D%2FUsers%2Fakash%2FDocuments%2Fprojects%2FSwiftUI%2FJupiter%2FTests%2FJupiterTests%2FLogMsgTests.swift%2C%20NSUnderlyingError%3D0x11ee0b0a0%20%7BError%20Domain%3DNSPOSIXErrorDomain%20Code%3D2%20%22No%20such%20file%20or%20directory%22%7D%7D%0A%0A%09at%20ChildProcess.exithandler%20(node%3Achild_process%3A406%3A12)%0A%09at%20ChildProcess.emit%20(node%3Aevents%3A390%3A28)%0A%09at%20maybeClose%20(node%3Ainternal%2Fchild_process%3A1064%3A16)%0A%09at%20Socket.%3Canonymous%3E%20(node%3Ainternal%2Fchild_process%3A450%3A11)%0A%09at%20Socket.emit%20(node%3Aevents%3A390%3A28)%0A%09at%20Pipe.%3Canonymous%3E%20(node%3Anet%3A687%3A12)%0Aos%3A%20darwin%60

Report Illegal value for `line`

Error: Illegal value for line at h._lineAt (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:384:469) at Object.lineAt (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:383:464) at /Users/dma-dev/.vscode/extensions/vknabel.vscode-swiftlint-1.0.0/out/lint.js:50:31 at Array.map (<anonymous>) at Object.<anonymous> (/Users/dma-dev/.vscode/extensions/vknabel.vscode-swiftlint-1.0.0/out/lint.js:26:37) at Generator.next (<anonymous>) at fulfilled (/Users/dma-dev/.vscode/extensions/vknabel.vscode-swiftlint-1.0.0/out/lint.js:5:58)

Report E2BIG spawn E2BIG

Error: spawn E2BIG
	at ChildProcess.spawn (internal/child_process.js:394:11)
	at spawn (child_process.js:549:9)
	at Object.execFile (child_process.js:233:17)
	at Object.module.<computed> [as execFile] (electron/js2c/asar.js:163:31)
	at /Users/prazak/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:154:38
	at new Promise (<anonymous>)
	at execSwiftlint (/Users/prazak/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:153:12)
	at Object.<anonymous> (/Users/prazak/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:59:38)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/prazak/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:5:58)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
os: darwin

URL decoded contents by @vknabel

Force Exclude Paths ignored

Hi, thanks for the extension, very nice!

I'm having trouble with the "Force Exclude Paths" feature.
I've tested both relative (relative to what though?) and absolute paths, in user and workspace settings, nothing seems to make any difference.

Use case: in a Flutter project I want to exclude the "ios/Pods" directory.
I add the path "ios/Pods" to the exclude paths.

I know the settings file gets picked up since the "Enable" setting work, but linting happens in my excluded path anyway.
What could be the issue here?

encountered this error: Report E2BIG spawn E2BIG

every time I launch the VSCode it shows but looks the lint works for me.

Error: spawn E2BIG
	at ChildProcess.spawn (internal/child_process.js:394:11)
	at spawn (child_process.js:553:9)
	at Object.execFile (child_process.js:237:17)
	at Object.module.<computed> [as execFile] (electron/js2c/asar.js:163:31)
	at /Users/gpake/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:129:38
	at new Promise (<anonymous>)
	at execSwiftlint (/Users/gpake/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:128:12)
	at Object.<anonymous> (/Users/gpake/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:47:38)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/gpake/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:5:58)

Report Cannot read property '0' of undefined

TypeError: Cannot read property '0' of undefined at SwiftLint.<anonymous> (/Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:53:56) at Generator.next (<anonymous>) at /Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:8:71 at new Promise (<anonymous>) at __awaiter (/Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:4:12) at SwiftLint.lintDocument (/Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:47:16) at /Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:37:18 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at i.$acceptModelModeChanged (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87:145687) at l._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:12836) at l._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:12520) at l._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:11187) at l._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:9973) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:8074 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at S.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15497) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:29764 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at S.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15497) at t._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:20755) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:17641 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12862) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12210 at Socket.v (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:13195) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) os: darwin

Report 1 Command failed: /usr/local/bin/swiftlint --use-script-input-files --quiet --reporter json --formatUnrecognized arguments: --format


Error: Command failed: /usr/local/bin/swiftlint --use-script-input-files --quiet --reporter json --format
Unrecognized arguments: --format

    at ChildProcess.exithandler (node:child_process:406:12)
    at ChildProcess.emit (node:events:390:28)
    at maybeClose (node:internal/child_process:1064:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
os: darwin

Report EBADF write EBADF

Error: write EBADF
    at afterWriteDispatched (internal/stream_base_commons.js:154:25)
    at writeGeneric (internal/stream_base_commons.js:145:3)
    at Socket._writeGeneric (net.js:786:11)
    at Socket._write (net.js:798:8)
    at doWrite (_stream_writable.js:403:12)
    at writeOrBuffer (_stream_writable.js:387:5)
    at Socket.Writable.write (_stream_writable.js:318:11)
    at Socket.Writable.end (_stream_writable.js:585:10)
    at Socket.end (net.js:590:31)
    at /Users/dex/.vscode/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:182:24
    at new Promise (<anonymous>)
    at execSwiftlint (/Users/dex/.vscode/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:156:12)
    at Object.<anonymous> (/Users/dex/.vscode/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:29:38)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/dex/.vscode/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:5:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
os: darwin

Report E2BIG spawn E2BIG

Error: spawn E2BIG at ChildProcess.spawn (internal/child_process.js:394:11) at spawn (child_process.js:553:9) at Object.execFile (child_process.js:237:17) at Object.module.<computed> [as execFile] (electron/js2c/asar.js:163:31) at /Users/thorsten/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:129:38 at new Promise (<anonymous>) at execSwiftlint (/Users/thorsten/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:128:12) at Object.<anonymous> (/Users/thorsten/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:47:38) at Generator.next (<anonymous>) at fulfilled (/Users/thorsten/.vscode/extensions/vknabel.vscode-swiftlint-1.0.5/out/lint.js:5:58)

Report Unexpected end of JSON input

SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at Object.<anonymous> (/home/krzyzak/.vscode/extensions/vknabel.vscode-swiftlint-1.0.3/out/lint.js:27:30) at Generator.next (<anonymous>) at fulfilled (/home/krzyzak/.vscode/extensions/vknabel.vscode-swiftlint-1.0.3/out/lint.js:5:58)

Report ERR_CHILD_PROCESS_STDIO_MAXBUFFER stdout maxBuffer length exceeded

RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER] [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded at Socket.onChildStdout (child_process.js:363:14) at Socket.emit (events.js:200:13) at Socket.EventEmitter.emit (domain.js:471:20) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:271:13) at Socket.Readable.push (_stream_readable.js:210:10) at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)

Report EPIPE write EPIPE

Error: write EPIPE at afterWriteDispatched (internal/stream_base_commons.js:146:25) at writeGeneric (internal/stream_base_commons.js:137:3) at Socket._writeGeneric (net.js:698:11) at Socket._write (net.js:710:8) at doWrite (_stream_writable.js:418:12) at writeOrBuffer (_stream_writable.js:402:5) at Socket.Writable.write (_stream_writable.js:302:11) at Socket.Writable.end (_stream_writable.js:583:10) at Socket.end (net.js:536:31) at /home/jon/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:176:24 at new Promise (<anonymous>) at execSwiftlint (/home/jon/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:150:12) at Object.<anonymous> (/home/jon/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:27:38) at Generator.next (<anonymous>) at fulfilled (/home/jon/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:5:58) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:85:5)

Report E2BIG spawn E2BIG

Error: spawn E2BIG
	at ChildProcess.spawn (internal/child_process.js:394:11)
	at spawn (child_process.js:553:9)
	at Object.execFile (child_process.js:237:17)
	at Object.module.<computed> [as execFile] (electron/js2c/asar.js:163:31)
	at /Users/pro/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:154:38
	at new Promise (<anonymous>)
	at execSwiftlint (/Users/pro/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:153:12)
	at Object.<anonymous> (/Users/pro/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:59:38)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/pro/.vscode/extensions/vknabel.vscode-swiftlint-1.2.4/out/lint.js:5:58)
	at processTicksAndRejections (internal/process/task_queues.js:85:5)
os: darwin

URL decoded contents by @vknabel

Report 1 Command failed: /usr/local/bin/swiftlint --use-script-input-files --quiet --reporter json --formatUnrecognized arguments: --format

%60Error%3A%20Command%20failed%3A%20%2Fusr%2Flocal%2Fbin%2Fswiftlint%20--use-script-input-files%20--quiet%20--reporter%20json%20--format%0AUnrecognized%20arguments%3A%20--format%0A%0A%20%20%20%20at%20ChildProcess.exithandler%20(node%3Achild_process%3A406%3A12)%0A%20%20%20%20at%20ChildProcess.emit%20(node%3Aevents%3A390%3A28)%0A%20%20%20%20at%20maybeClose%20(node%3Ainternal%2Fchild_process%3A1064%3A16)%0A%20%20%20%20at%20Socket.%3Canonymous%3E%20(node%3Ainternal%2Fchild_process%3A450%3A11)%0A%20%20%20%20at%20Socket.emit%20(node%3Aevents%3A390%3A28)%0A%20%20%20%20at%20Pipe.%3Canonymous%3E%20(node%3Anet%3A687%3A12)%0Aos%3A%20darwin%60

Report Command failed: /usr/local/bin/swiftlint --quiet --reporter json --formatSourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading libsourcekitdInProc.so failed

%60Error%3A%20Command%20failed%3A%20%2Fusr%2Flocal%2Fbin%2Fswiftlint%20--quiet%20--reporter%20json%20--format%0ASourceKittenFramework%2Flibrary_wrapper.swift%3A31%3A%20Fatal%20error%3A%20Loading%20libsourcekitdInProc.so%20failed%0A%0A%09at%20ChildProcess.exithandler%20(node%3Achild_process%3A399%3A12)%0A%09at%20ChildProcess.emit%20(node%3Aevents%3A526%3A28)%0A%09at%20maybeClose%20(node%3Ainternal%2Fchild_process%3A1092%3A16)%0A%09at%20Socket.%3Canonymous%3E%20(node%3Ainternal%2Fchild_process%3A451%3A11)%0A%09at%20Socket.emit%20(node%3Aevents%3A526%3A28)%0A%09at%20Pipe.%3Canonymous%3E%20(node%3Anet%3A687%3A12)%0Aos%3A%20linux%60

Report EPIPE write EPIPE

Error: write EPIPE at afterWriteDispatched (internal/stream_base_commons.js:146:25) at writeGeneric (internal/stream_base_commons.js:137:3) at Socket._writeGeneric (net.js:698:11) at Socket._write (net.js:710:8) at doWrite (_stream_writable.js:418:12) at writeOrBuffer (_stream_writable.js:402:5) at Socket.Writable.write (_stream_writable.js:302:11) at Socket.Writable.end (_stream_writable.js:583:10) at Socket.end (net.js:536:31) at /Users/marcossouza/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:176:24 at new Promise (<anonymous>) at execSwiftlint (/Users/marcossouza/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:150:12) at Object.<anonymous> (/Users/marcossouza/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:27:38) at Generator.next (<anonymous>) at fulfilled (/Users/marcossouza/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:5:58) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:85:5)

Report Cannot read property '0' of undefined

TypeError: Cannot read property '0' of undefined at SwiftLint.<anonymous> (/Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:53:56) at Generator.next (<anonymous>) at /Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:8:71 at new Promise (<anonymous>) at __awaiter (/Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:4:12) at SwiftLint.lintDocument (/Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:47:16) at /Users/marksemsel/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:33:22 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at i.$acceptModelSaved (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87:145894) at l._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:12836) at l._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:12520) at l._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:11187) at l._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:9973) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:8074 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at S.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15497) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:29764 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at S.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15497) at t._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:20755) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:17641 at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836) at acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12862) at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12210 at Socket.v (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:13195) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) os: darwin

Report Map keys must be unique

YAMLSemanticError: Map keys must be unique; "disabled_rules" is repeated
	at Object.parseMap [as resolve] (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/schema/parseMap.js:80:27)
	at Schema.resolveNode (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/schema/index.js:182:27)
	at Schema.resolveNodeWithFallback (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/schema/index.js:205:22)
	at Document.resolveNode (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/Document.js:503:22)
	at /Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/Document.js:231:26
	at Array.forEach (<anonymous>)
	at Document.parseContents (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/Document.js:224:14)
	at Document.parse (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/Document.js:157:10)
	at parseDocument (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/index.js:68:37)
	at Object.parse (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/node_modules/yaml/dist/index.js:79:15)
	at Function.<anonymous> (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/out/SwiftLintConfig.js:37:33)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/onurdikyar/.vscode/extensions/vknabel.vscode-swiftlint-1.2.7/out/SwiftLintConfig.js:5:58)
os: darwin

Report EPIPE write EPIPE

Error: write EPIPE at afterWriteDispatched (internal/stream_base_commons.js:146:25) at writeGeneric (internal/stream_base_commons.js:137:3) at Socket._writeGeneric (net.js:698:11) at Socket._write (net.js:710:8) at doWrite (_stream_writable.js:418:12) at writeOrBuffer (_stream_writable.js:402:5) at Socket.Writable.write (_stream_writable.js:302:11) at Socket.Writable.end (_stream_writable.js:583:10) at Socket.end (net.js:536:31) at /Users/junyingyang/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:176:24 at new Promise (<anonymous>) at execSwiftlint (/Users/junyingyang/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:150:12) at Object.<anonymous> (/Users/junyingyang/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:27:38) at Generator.next (<anonymous>) at fulfilled (/Users/junyingyang/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:5:58)

Report EPIPE write EPIPE

Error: write EPIPE at afterWriteDispatched (internal/stream_base_commons.js:146:25) at writeGeneric (internal/stream_base_commons.js:137:3) at Socket._writeGeneric (net.js:698:11) at Socket._write (net.js:710:8) at doWrite (_stream_writable.js:418:12) at writeOrBuffer (_stream_writable.js:402:5) at Socket.Writable.write (_stream_writable.js:302:11) at Socket.Writable.end (_stream_writable.js:583:10) at Socket.end (net.js:536:31) at /Users/jasonmoore/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:176:24 at new Promise (<anonymous>) at execSwiftlint (/Users/jasonmoore/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:150:12) at Object.<anonymous> (/Users/jasonmoore/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:27:38) at Generator.next (<anonymous>) at fulfilled (/Users/jasonmoore/.vscode/extensions/vknabel.vscode-swiftlint-1.2.2/out/lint.js:5:58) at processTicksAndRejections (internal/process/task_queues.js:85:5)

Report E2BIG spawn E2BIG

Error: spawn E2BIG
	at ChildProcess.spawn (internal/child_process.js:394:11)
	at spawn (child_process.js:549:9)
	at Object.execFile (child_process.js:233:17)
	at Object.module.<computed> [as execFile] (electron/js2c/asar.js:163:31)
	at /Users/jose.artavia/.vscode/extensions/vknabel.vscode-swiftlint-1.2.6/out/lint.js:154:38
	at new Promise (<anonymous>)
	at execSwiftlint (/Users/jose.artavia/.vscode/extensions/vknabel.vscode-swiftlint-1.2.6/out/lint.js:153:12)
	at Object.<anonymous> (/Users/jose.artavia/.vscode/extensions/vknabel.vscode-swiftlint-1.2.6/out/lint.js:59:38)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/jose.artavia/.vscode/extensions/vknabel.vscode-swiftlint-1.2.6/out/lint.js:5:58)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
os: darwin

Report Illegal value for `line`

Error: Illegal value for line at h._lineAt (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:384:469) at Object.lineAt (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:383:464) at /Users/derekli/.vscode/extensions/vknabel.vscode-swiftlint-1.0.0/out/lint.js:50:31 at Array.map (<anonymous>) at Object.<anonymous> (/Users/derekli/.vscode/extensions/vknabel.vscode-swiftlint-1.0.0/out/lint.js:26:37) at Generator.next (<anonymous>) at fulfilled (/Users/derekli/.vscode/extensions/vknabel.vscode-swiftlint-1.0.0/out/lint.js:5:58)

Ability to format on save

#40 means we are able to fix lint errors on save.

I like to be able to format my documents using swiftlint as well:

swiftlint --fix --format

Might it be of interest to add formatting as an option as well as fixAll?

Report Command failed: /usr/local/bin/swiftlint

/usr/local/bin/swiftlint --quiet --reporter jsonerror opening input file '/Users/mac/Documents/.swift' (No such file or directory)Most rules will be skipped because sourcekitd has failed.Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/mac/Documents/../.swift, NSUnderlyingError=0x7ff61d0f84a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}: file /private/tmp/swiftlint-20200404-90819-1vnlirh/.build/checkouts/SourceKitten/Source/SourceKittenFramework/File.swift, line 28
Error: Command failed: /usr/local/bin/swiftlint --quiet --reporter json
error opening input file '/Users/mac/Documents/.swift' (No such file or directory)
Most rules will be skipped because sourcekitd has failed.
Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “FeedSwitchUserGuideView.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/mac/Documents/development/LarkProjects/ios-infra/Bizs/LarkGuide/LarkGuide/view/FeedSwitchUserGuideView.swift, NSUnderlyingError=0x7ff61d0f84a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}: file /private/tmp/swiftlint-20200404-90819-1vnlirh/.build/checkouts/SourceKitten/Source/SourceKittenFramework/File.swift, line 28

	at ChildProcess.exithandler (child_process.js:312:12)
	at ChildProcess.emit (events.js:315:20)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
os: darwin

Report EPIPE write EPIPE

Error: write EPIPE at afterWriteDispatched (internal/stream_base_commons.js:146:25) at writeGeneric (internal/stream_base_commons.js:137:3) at Socket._writeGeneric (net.js:698:11) at Socket._write (net.js:710:8) at doWrite (_stream_writable.js:418:12) at writeOrBuffer (_stream_writable.js:402:5) at Socket.Writable.write (_stream_writable.js:302:11) at Socket.Writable.end (_stream_writable.js:583:10) at Socket.end (net.js:536:31) at c:\Users\Dell\.vscode\extensions\vknabel.vscode-swiftlint-1.1.0\out\lint.js:174:24 at new Promise (<anonymous>) at execSwiftlint (c:\Users\Dell\.vscode\extensions\vknabel.vscode-swiftlint-1.1.0\out\lint.js:148:12) at Object.<anonymous> (c:\Users\Dell\.vscode\extensions\vknabel.vscode-swiftlint-1.1.0\out\lint.js:28:38) at Generator.next (<anonymous>) at fulfilled (c:\Users\Dell\.vscode\extensions\vknabel.vscode-swiftlint-1.1.0\out\lint.js:5:58)

Report Command failed: /home/xxx/Desktop/SwiftTest/.build/release/swiftlint --quiet --reporter json --formatSourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading libsourcekitdInProc.so failed

Error: Command failed: /home/xxx/Desktop/SwiftTest/.build/release/swiftlint --quiet --reporter json --format
SourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading libsourcekitdInProc.so failed

	at ChildProcess.exithandler (node:child_process:406:12)
	at ChildProcess.emit (node:events:390:28)
	at maybeClose (node:internal/child_process:1064:16)
	at Socket.<anonymous> (node:internal/child_process:450:11)
	at Socket.emit (node:events:390:28)
	at Pipe.<anonymous> (node:net:687:12)
os: linux

V1.2.1 does not work at all

Hi,

I reinstalled vscode from scratch, removed ~/Library/Application Support/Code and ~/.vscode. Also removed stuff from caches and then installed just this extension. So this was the only extension installed. The version is 1.2.1.

If I then open a .swift file nothing happens. (I know there are lint issues that should be flagged)
Also no errors etc.

I then downgraded to version 1.2.0.

I get one error on startup being:

An unknown error occurred. spawn E2BIG

Source: SwiftLint (Extension)

One I clicked that error away everything works. So I get my expected lint warnings.

I then upgraded again to 1.2.1 and then it stops working again. No error and a silent lint output.

I also moved my .swiftlint.yml file outside my tree to see if that had any effect. It doesn't.

Let me know if I need to provide more information.

.swiftlint.yml partially ignored?

I have the following .swiftlint.yml file:

included:
  - Sources

If I run on the commandline, swiftlint will report a clean sheet, no issues.

If I then run this from vscode I get 7K errors.

The errors are in the top level directories .macos and .linux. Those are my build directories which are separated for MacOS and Linux builds.

To add to this I added excluded lines to my config:

included:
  - Sources
excluded:
  - .linux
  - .macos

This improves things but strange enough there are still 6 issues reported on files in the .linux and .macos directories. So apparently the configuration file .swiftlint.yml is seen and read but not fully followed up upon.

vscode itself creates an additional .build directory. That directory also contains the checked out code which is always ignored. So perhaps there is some hardcoding on the .build directory name here.

Finally if I run swiftlint from the terminal within vscode there are no issues.

I hope I have provided you with enough information here.

Report Command failed: /opt/homebrew/bin/swiftlint --quiet --reporter json --formatxcrun: error: active developer path ("/Applications/Xcode-beta.app/Contents/Developer") does not existUse `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.See `man xcode-select` for more details.SourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading sourcekitd.framework/Versions/A/sourcekitd failed

%60Error%3A%20Command%20failed%3A%20%2Fopt%2Fhomebrew%2Fbin%2Fswiftlint%20--quiet%20--reporter%20json%20--format%0Axcrun%3A%20error%3A%20active%20developer%20path%20(%22%2FApplications%2FXcode-beta.app%2FContents%2FDeveloper%22)%20does%20not%20exist%0AUse%20%60sudo%20xcode-select%20--switch%20path%2Fto%2FXcode.app%60%20to%20specify%20the%20Xcode%20that%20you%20wish%20to%20use%20for%20command%20line%20developer%20tools%2C%20or%20use%20%60xcode-select%20--install%60%20to%20install%20the%20standalone%20command%20line%20developer%20tools.%0ASee%20%60man%20xcode-select%60%20for%20more%20details.%0ASourceKittenFramework%2Flibrary_wrapper.swift%3A31%3A%20Fatal%20error%3A%20Loading%20sourcekitd.framework%2FVersions%2FA%2Fsourcekitd%20failed%0A%0A%09at%20ChildProcess.exithandler%20(node%3Achild_process%3A406%3A12)%0A%09at%20ChildProcess.emit%20(node%3Aevents%3A390%3A28)%0A%09at%20maybeClose%20(node%3Ainternal%2Fchild_process%3A1064%3A16)%0A%09at%20Socket.%3Canonymous%3E%20(node%3Ainternal%2Fchild_process%3A450%3A11)%0A%09at%20Socket.emit%20(node%3Aevents%3A390%3A28)%0A%09at%20Pipe.%3Canonymous%3E%20(node%3Anet%3A687%3A12)%0Aos%3A%20darwin%60

Linting fails over Live Share

Report Command failed: /opt/homebrew/bin/swiftlint --use-script-input-files --quiet --reporter json --formaterror opening input file '/Tests/WorkInModelTests/WorkInModelTests.swift' (No such file or directory)Most rules will be skipped because sourcekitd has failed.SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “WorkInModelTests.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Tests/WorkInModelTests/WorkInModelTests.swift, NSUnderlyingError=0x12e0140e0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}


`Error: Command failed: /opt/homebrew/bin/swiftlint --use-script-input-files --quiet --reporter json --format
error opening input file '/Tests/WorkInModelTests/WorkInModelTests.swift' (No such file or directory)
Most rules will be skipped because sourcekitd has failed.
SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “WorkInModelTests.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Tests/WorkInModelTests/WorkInModelTests.swift, NSUnderlyingError=0x12e0140e0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

	at ChildProcess.exithandler (node:child_process:406:12)
	at ChildProcess.emit (node:events:390:28)
	at maybeClose (node:internal/child_process:1064:16)
	at Socket.<anonymous> (node:internal/child_process:450:11)
	at Socket.emit (node:events:390:28)
	at Pipe.<anonymous> (node:net:687:12)
os: darwin`

Extension doesn't support parent/child configuration

Apparently nested configurations was such a mess in SwiftLint that they completely broke the way it worked before and introduced the new parent/child configuration support.
https://github.com/realm/SwiftLint#child--parent-configs-locally

The extension doesn't support it though.

In my example I had the parent config sitting in the root of my project and a child config sitting few levels down referring back to child config.
For example

root
├── .swiftlint.yml
└── dir
    └── dir
        └── .swiftlint.yml

The parent config doesn't disable force_try which is on by default.
The dir/dir/.swiflint.yml child config referes to parent config and disables force_try rule for all files sitting in dir/dir.

parent_config: ../../.swiftlint.yml

disabled_rules:
  - force_try

This works good with command line invocations, e.g.

cd root
swiftlint .

It will respect child configs.

The extension doesn't though.
Initially when the project is loaded it seems to report force_try for all files including those in dir/dir which should not be reported.
But then, when I actually open the file from dir/dir in the editor, it doesn't just report force_try but also seems to completely disregard the parent .swiftlint.yml from the root and use default SwiftLint ruleset like 120 char line limit and so on.

I tried adding all the .swiftlint.yml files to Config Search Paths but it didn't make any difference and I wouldn't really want to add every single .swiftlint.yml in the project to the settings, it's difficult to maintain.

Report Command failed: /usr/local/bin/swiftlint --quiet --reporter jsonSourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading sourcekitd.framework/Versions/A/sourcekitd failed

Error: Command failed: /usr/local/bin/swiftlint --quiet --reporter json
SourceKittenFramework/library_wrapper.swift:31: Fatal error: Loading sourcekitd.framework/Versions/A/sourcekitd failed

    at ChildProcess.exithandler (child_process.js:312:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
os: darwin

Report 1 Command failed: /usr/local/Cellar/swiftlint/0.43.1/bin/swiftlint --use-script-input-files --quiet --reporter jsonError: No lintable files found at paths: ''

%60Error%3A%20Command%20failed%3A%20%2Fusr%2Flocal%2FCellar%2Fswiftlint%2F0.43.1%2Fbin%2Fswiftlint%20--use-script-input-files%20--quiet%20--reporter%20json%0AError%3A%20No%20lintable%20files%20found%20at%20paths%3A%20''%0A%0A%09at%20ChildProcess.exithandler%20(child_process.js%3A317%3A12)%0A%09at%20ChildProcess.emit%20(events.js%3A315%3A20)%0A%09at%20maybeClose%20(internal%2Fchild_process.js%3A1048%3A16)%0A%09at%20Process.ChildProcess._handle.onexit%20(internal%2Fchild_process.js%3A288%3A5)%0Aos%3A%20darwin%60

Report EPIPE write EPIPE

Error: write EPIPE at afterWriteDispatched (internal/stream_base_commons.js:146:25) at writeGeneric (internal/stream_base_commons.js:137:3) at Socket._writeGeneric (net.js:698:11) at Socket._write (net.js:710:8) at doWrite (_stream_writable.js:418:12) at writeOrBuffer (_stream_writable.js:402:5) at Socket.Writable.write (_stream_writable.js:302:11) at Socket.Writable.end (_stream_writable.js:583:10) at Socket.end (net.js:536:31) at /Users/jpsasi/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:176:24 at new Promise (<anonymous>) at execSwiftlint (/Users/jpsasi/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:150:12) at Object.<anonymous> (/Users/jpsasi/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:27:38) at Generator.next (<anonymous>) at fulfilled (/Users/jpsasi/.vscode/extensions/vknabel.vscode-swiftlint-1.2.3/out/lint.js:5:58) at processTicksAndRejections (internal/process/task_queues.js:85:5)

Report EBADF write EBADF

Error: write EBADF
	at afterWriteDispatched (internal/stream_base_commons.js:154:25)
	at writeGeneric (internal/stream_base_commons.js:145:3)
	at Socket._writeGeneric (net.js:786:11)
	at Socket._write (net.js:798:8)
	at doWrite (_stream_writable.js:403:12)
	at writeOrBuffer (_stream_writable.js:387:5)
	at Socket.Writable.write (_stream_writable.js:318:11)
	at Socket.Writable.end (_stream_writable.js:585:10)
	at Socket.end (net.js:590:31)
	at /Users/shai.mishali/.vscode-insiders/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:182:24
	at new Promise (<anonymous>)
	at execSwiftlint (/Users/shai.mishali/.vscode-insiders/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:156:12)
	at Object.<anonymous> (/Users/shai.mishali/.vscode-insiders/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:29:38)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/shai.mishali/.vscode-insiders/extensions/vknabel.vscode-swiftlint-1.4.0/out/lint.js:5:58)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:97:5)
os: darwin

Report Cannot read property '0' of undefined

I keep getting the following error notification when I press CMD+S to save the current file:

image

TypeError: Cannot read property '0' of undefined
	at SwiftLint.<anonymous> (/Users/robert/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:53:56)
	at Generator.next (<anonymous>)
	at /Users/robert/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:8:71
	at new Promise (<anonymous>)
	at __awaiter (/Users/robert/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:4:12)
	at SwiftLint.lintDocument (/Users/robert/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:47:16)
	at /Users/robert/.vscode/extensions/vknabel.vscode-swiftlint-1.4.5/out/SwiftLintProvider.js:33:22
	at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836)
	at i.$acceptModelSaved (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87:145894)
	at l._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:12836)
	at l._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:12520)
	at l._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:11187)
	at l._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:9973)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:91:8074
	at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836)
	at S.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15497)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:29764
	at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836)
	at S.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15497)
	at t._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:20755)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:17641
	at fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836)
	at acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12862)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12210
	at Socket.v (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:106:13195)
	at Socket.emit (events.js:315:20)
	at addChunk (internal/streams/readable.js:309:12)
	at readableAddChunk (internal/streams/readable.js:284:9)
	at Socket.Readable.push (internal/streams/readable.js:223:10)
	at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
os: darwin

Wildcards in .swiftlint config are ignored.

I am adding some paths to the excluded rule in my swiftlint config to ignore some test files:

excluded:
  - Tests/*/*Tests.swift
  - Tests/*/*/*Tests.swift
  - Tests/*/*/*/*Tests.swift

However, it seems that the extension is ignoring these paths as I still get swiftlint warnings in vscode for these excluded files. If I run swiftlint from the command line, it ignores these excluded files and everything is fine.

I can't just ignore the Tests folder as I have files (that don't end in "Test.swift") that I want to lint.

Report 1 Command failed: /usr/local/bin/swiftlint --quiet --reporter json --config /Users/fred/Dropbox/projects/Keychain/.swiftlint.ymlNo lintable files found at paths: ''

`Error: Command failed: /usr/local/bin/swiftlint --quiet --reporter json --config xxxxxx/Keychain/.swiftlint.yml
No lintable files found at paths: ''

at ChildProcess.exithandler (child_process.js:303:12)
at ChildProcess.emit (events.js:200:13)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)`

Note that I changed the leading patch to xxxxxxx in this error report.

If I run the same command in the terminal I get this:

/usr/local/bin/swiftlint --quiet --reporter json --config xxxxxxx/Keychain/.swiftlint.yml
[

]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.