From 80bf895c42910fea8a7ca3a6a3afc87c6279cbe6 Mon Sep 17 00:00:00 2001 From: swiftty <62803132+swiftty@users.noreply.github.com> Date: Wed, 12 Jun 2024 00:38:46 +0900 Subject: [PATCH] Fix correction when correction range is before the violation location --- Source/SwiftLintCore/Extensions/SwiftLintFile+Regex.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/SwiftLintCore/Extensions/SwiftLintFile+Regex.swift b/Source/SwiftLintCore/Extensions/SwiftLintFile+Regex.swift index 41d8b10204b..b5d2a8e0b3d 100644 --- a/Source/SwiftLintCore/Extensions/SwiftLintFile+Regex.swift +++ b/Source/SwiftLintCore/Extensions/SwiftLintFile+Regex.swift @@ -273,6 +273,7 @@ extension SwiftLintFile { return violatingRanges.filter { range in let region = fileRegions.first { $0.contains(Location(file: self, characterOffset: range.location)) + || $0.contains(Location(file: self, characterOffset: range.location + range.length - 1)) } return region?.isRuleEnabled(rule) ?? true }