From 445f26cf4a6375ef52a7899ef5dfed51f2f1adfb Mon Sep 17 00:00:00 2001 From: SimplyDanny Date: Sat, 7 Dec 2024 14:50:43 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20Workflow=20in=20'realm/SwiftLint?= =?UTF-8?q?'=20synced=20local=20'Plugins/'=20with=20remote=20'Plugins/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SwiftLintCommandPlugin.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Plugins/SwiftLintCommandPlugin/SwiftLintCommandPlugin.swift b/Plugins/SwiftLintCommandPlugin/SwiftLintCommandPlugin.swift index 21754b5..fb208c4 100644 --- a/Plugins/SwiftLintCommandPlugin/SwiftLintCommandPlugin.swift +++ b/Plugins/SwiftLintCommandPlugin/SwiftLintCommandPlugin.swift @@ -42,10 +42,20 @@ extension SwiftLintCommandPlugin { var argExtractor = ArgumentExtractor(arguments) let targetNames = argExtractor.extractOption(named: "target") let remainingArguments = argExtractor.remainingArguments - guard !targetNames.isEmpty, commandsNotExpectingPaths.isDisjoint(with: remainingArguments) else { + + if !commandsNotExpectingPaths.isDisjoint(with: remainingArguments) { try lintFiles(with: context, arguments: remainingArguments) return } + guard !targetNames.isEmpty else { + if let pathArgument = remainingArguments.last, FileManager.default.fileExists(atPath: pathArgument) { + Diagnostics.remark("No targets provided. Files provided in path arguments will be linted.") + try lintFiles(in: [], with: context, arguments: remainingArguments) + } else { + try lintFiles(with: context, arguments: remainingArguments) + } + return + } for target in try context.targets(named: targetNames) { try lintFiles(in: target.paths, for: target.name, with: context, arguments: remainingArguments) }