-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect scattered disable commands in
duplicate_imports
rule (#5432)
- Loading branch information
1 parent
7f960d3
commit 1e9428a
Showing
3 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Tests/SwiftLintFrameworkTests/DuplicateImportsRuleTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@testable import SwiftLintBuiltInRules | ||
import XCTest | ||
|
||
class DuplicateImportsRuleTests: XCTestCase { | ||
func testDisableCommand() { | ||
let content = """ | ||
import InspireAPI | ||
// swiftlint:disable:next duplicate_imports | ||
import class InspireAPI.Response | ||
""" | ||
let file = SwiftLintFile(contents: content) | ||
|
||
_ = DuplicateImportsRule().correct(file: file) | ||
|
||
XCTAssertEqual(file.contents, content) | ||
} | ||
} |