realm / realm/SwiftLint

lint with use-script-input-files option hangs when non existing file passed

Open
#3,969 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
Describe the bug

When a non existing file is getting passed into swiftlint, I expect it to return some error code, but it just hangs and doesn't return.

Complete output when running SwiftLint, including the stack trace and command used
$ SCRIPT_INPUT_FILE_0=nonExistingFile.swift SCRIPT_INPUT_FILE_COUNT=1 swiftlint lint --use-script-input-files
Linting 'nonExistingFile.swift' (1/1)
SourceKittenFramework/File.swift:20: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=260 "The file “nonExistingFile.swift” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/phil/Developer/Cupixel/cupixel-studio-ios-pre/nonExistingFile.swift, NSUnderlyingError=0x600002e2c630 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
^C
Environment
  • SwiftLint version (run swiftlint version to be sure)? 0.47.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew, M1 based mac.
  • Paste your configuration file: problem occurs with an empty config file
  • Which Xcode version are you using (check xcodebuild -version)? Xcode 13.3.1, Build version 13E500a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with SCRIPT_INPUT_FILE_0=nonExistingFile.swift SCRIPT_INPUT_FILE_COUNT=1 swiftlint lint --use-script-input-files, then trace the handling of script input files. Done means SwiftLint returns an error code for a missing file instead of hanging after the fatal file-open error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.