Skip to content

Commit

Permalink
Fix rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fredpi committed Apr 15, 2020
1 parent b2f5847 commit 707ccf3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
found issues.
[krin-san](https://github.com/krin-san)
[#3177](https://github.com/realm/SwiftLint/pull/3177)

* Add option to specify a `child_config` / `parent_config` file
(local or remote) in any SwiftLint configuration file.
Allow passing multiple configuration files via the command line.
[Frederick Pietschmann](https://github.com/fredpi)
[#1352](https://github.com/realm/SwiftLint/issues/1352)

#### Bug Fixes

Expand Down Expand Up @@ -117,12 +123,6 @@ This is the last release to support building with Swift 5.0.x.
* Add `deinitializer` type content to `type_contents_order` rule instead of
grouping it with initializers.
[Steven Magdy](https://github.com/StevenMagdy)

* Add option to specify a `child_config` / `parent_config` file
(local or remote) in any SwiftLint configuration file.
Allow passing multiple configuration files via the command line.
[Frederick Pietschmann](https://github.com/fredpi)
[#1352](https://github.com/realm/SwiftLint/issues/1352)

* Inline test failure messages to make development of SwiftLint easier. Test
failures in triggering and non-triggering examples will appear inline in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal extension Configuration {
private static var isOptInRuleCache: [String: Bool] = [:]

public let allRulesWrapped: [ConfigurationRuleWrapper]
private let mode: RulesMode
internal let mode: RulesMode
private let aliasResolver: (String) -> String

private var invalidRuleIdsWarnedAbout: Set<String> = []
Expand Down
10 changes: 7 additions & 3 deletions Source/SwiftLintFramework/Models/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,16 @@ public struct Configuration {
/// The identifier for the `Reporter` to use to report style violations.
public let reporter: String

/// The location of the persisted cache to use whith this configuration.
/// The location of the persisted cache to use with this configuration.
public let cachePath: String?

/// Allow or disallow SwiftLint to exit successfully when passed only ignored or unlintable files
/// Allow or disallow SwiftLint to exit successfully when passed only ignored or unlintable files.
public let allowZeroLintableFiles: Bool

// MARK: Public Computed
/// The rules mode used for this configuration.
public var rulesMode: RulesMode { return rulesWrapper.mode }

// MARK: Internal Instance
internal var computedCacheDescription: String?
internal var fileGraph: FileGraph?
Expand Down Expand Up @@ -181,7 +185,7 @@ public struct Configuration {
rootDir = root
} else if let rootDirComps = configurationFiles.first?.components(separatedBy: "/").dropLast(),
!rootDirComps.isEmpty,
!configurationFiles.contains { $0.components(separatedBy: "/").dropLast() != rootDirComps } {
!(configurationFiles.contains { $0.components(separatedBy: "/").dropLast() != rootDirComps }) {
rootDir = rootDirComps.joined(separator: "/")
configurationFiles = configurationFiles.map { $0.components(separatedBy: "/").last ?? "" }
} else {
Expand Down
13 changes: 4 additions & 9 deletions Tests/SwiftLintFrameworkTests/ConfigurationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,8 @@ class ConfigurationTests: XCTestCase, ProjectMock {
let filenames = paths.map { $0.bridge().lastPathComponent }.sorted()
let expectedFilenames = [
"DirectoryLevel1.swift",
"Level0.swift",
"Level1.swift",
"Level2.swift",
"Level3.swift",
"Valid1.swift",
"Valid2.swift",
"Main.swift",
"Sub.swift"
"Level0.swift", "Level1.swift", "Level2.swift", "Level3.swift",
"Valid1.swift", "Valid2.swift", "Main.swift", "Sub.swift"
]

XCTAssertEqual(Set(expectedFilenames), Set(filenames))
Expand Down Expand Up @@ -315,7 +309,8 @@ class ConfigurationTests: XCTestCase, ProjectMock {
}

func testAllowZeroLintableFiles() {
let configuration = Configuration(dict: ["allow_zero_lintable_files": true])!
// swiftlint:disable:next force_try
let configuration = try! Configuration(dict: ["allow_zero_lintable_files": true])
XCTAssertTrue(configuration.allowZeroLintableFiles)
}
}
8 changes: 4 additions & 4 deletions Tests/SwiftLintFrameworkTests/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@ private func testCorrection(_ correction: (Example, Example),
var config = configuration
if let correctionConfiguration = correction.0.configuration,
case let .whitelisted(whitelistedRules) = configuration.rulesMode,
let firstWhitelistedRule = whitelistedRules.first,
case let configDict = ["whitelist_rules": whitelistedRules, firstWhitelistedRule: correctionConfiguration],
let typedConfiguration = Configuration(dict: configDict) {
config = configuration.merge(with: typedConfiguration)
let ruleToConfigure = (whitelistedRules.first { $0 != SuperfluousDisableCommandRule.description.identifier }),
case let configDict = ["whitelist_rules": whitelistedRules, ruleToConfigure: correctionConfiguration],
let typedConfiguration = try? Configuration(dict: configDict) {
config = configuration.merged(withChild: typedConfiguration)
}

config.assertCorrection(correction.0, expected: correction.1)
Expand Down

0 comments on commit 707ccf3

Please sign in to comment.