diff --git a/.swiftlint.yml b/.swiftlint.yml index 30bbb184..38fc812d 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,17 +1,17 @@ disabled_rules: # rule identifiers to exclude from running - - line_length - - nesting - - identifier_name - - large_tuple + - cyclomatic_complexity - file_length + - function_body_length + - identifier_name - implicit_return # Re-enable when we drop support for Swift 4.2 + - large_tuple + - line_length + - nesting + - type_body_length statement_position: statement_mode: uncuddled_else -function_body_length: - - 75 # warning - opt_in_rules: - anyobject_protocol - identical_operands diff --git a/BonMot.podspec b/BonMot.podspec index 411df2de..f1f18ad2 100644 --- a/BonMot.podspec +++ b/BonMot.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "BonMot" - s.version = "6.1.2" + s.version = "6.1.3" s.summary = "Beautiful, easy attributed strings in Swift" s.swift_versions = ["5.0"] s.description = <<-DESC diff --git a/Example-iOS/DemoStrings.swift b/Example-iOS/DemoStrings.swift index 06742ba7..5fc87488 100644 --- a/Example-iOS/DemoStrings.swift +++ b/Example-iOS/DemoStrings.swift @@ -11,7 +11,6 @@ import UIKit typealias StringStyle = BonMot.StringStyle -// swiftlint:disable type_body_length file_length enum DemoStrings { // A Simple Example @@ -436,7 +435,6 @@ enum DemoStrings { }() } -// swiftlint:enable type_body_length extension DemoStrings { @@ -451,5 +449,3 @@ extension DemoStrings { } } - -// swiftlint:enable file_length diff --git a/Gemfile.lock b/Gemfile.lock index 8313d32e..978dfa6b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,12 +3,12 @@ GEM specs: CFPropertyList (3.0.6) rexml - activesupport (7.0.4.3) + activesupport (7.0.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.1) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) @@ -16,17 +16,17 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.2.0) - aws-partitions (1.731.0) - aws-sdk-core (3.170.1) + aws-partitions (1.777.0) + aws-sdk-core (3.174.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.63.0) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-kms (1.66.0) + aws-sdk-core (~> 3, >= 3.174.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.119.1) - aws-sdk-core (~> 3, >= 3.165.0) + aws-sdk-s3 (1.123.1) + aws-sdk-core (~> 3, >= 3.174.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) aws-sigv4 (1.5.2) @@ -41,10 +41,10 @@ GEM nap open4 (~> 1.3) clamp (1.3.2) - cocoapods (1.12.0) + cocoapods (1.12.1) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.12.0) + cocoapods-core (= 1.12.1) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.6.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -59,7 +59,7 @@ GEM nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.12.0) + cocoapods-core (1.12.1) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -85,23 +85,23 @@ GEM concurrent-ruby (1.2.2) cork (0.3.0) colored2 (~> 3.1) - danger (9.2.0) + danger (9.3.1) claide (~> 1.0) claide-plugins (>= 0.9.2) colored2 (~> 3.1) cork (~> 0.1) faraday (>= 0.9.0, < 3.0) faraday-http-cache (~> 2.0) - git (~> 1.7) + git (~> 1.13) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.0) no_proxy_fix - octokit (~> 5.0) + octokit (~> 6.0) terminal-table (>= 1, < 4) danger-junit (1.0.2) danger (> 2.0) ox (~> 2.0) - danger-swiftlint (0.32.0) + danger-swiftlint (0.33.0) danger rake (> 10) thor (~> 0.19) @@ -118,7 +118,7 @@ GEM escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - excon (0.99.0) + excon (0.100.0) faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -137,7 +137,7 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) - faraday-http-cache (2.4.1) + faraday-http-cache (2.5.0) faraday (>= 0.8) faraday-httpclient (1.0.1) faraday-multipart (1.0.4) @@ -149,8 +149,8 @@ GEM faraday-retry (1.0.3) faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.2.6) - fastlane (2.212.1) + fastimage (2.2.7) + fastlane (2.213.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -174,7 +174,7 @@ GEM json (< 3.0.0) jwt (>= 2.1.0, < 3) mini_magick (>= 4.9.4, < 5.0.0) - multipart-post (~> 2.0.0) + multipart-post (>= 2.0.0, < 3.0.0) naturally (~> 2.2) optparse (~> 0.1.1) plist (>= 3.1.0, < 4.0.0) @@ -196,7 +196,7 @@ GEM git (1.18.0) addressable (~> 2.8) rchardet (~> 1.8) - google-apis-androidpublisher_v3 (0.37.0) + google-apis-androidpublisher_v3 (0.43.0) google-apis-core (>= 0.11.0, < 2.a) google-apis-core (0.11.0) addressable (~> 2.5, >= 2.5.1) @@ -227,7 +227,7 @@ GEM google-cloud-core (~> 1.6) googleauth (>= 0.16.2, < 2.a) mini_mime (~> 1.0) - googleauth (1.3.0) + googleauth (1.5.2) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) memoist (~> 0.16) @@ -238,11 +238,11 @@ GEM http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) jmespath (1.6.2) json (2.6.3) - jwt (2.7.0) + jwt (2.7.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -250,29 +250,29 @@ GEM memoist (0.16.2) mini_magick (4.12.0) mini_mime (1.1.2) - mini_portile2 (2.8.1) + mini_portile2 (2.8.2) minitest (5.18.0) molinillo (0.8.0) multi_json (1.15.0) - multipart-post (2.0.0) + multipart-post (2.3.0) nanaimo (0.3.0) nap (1.1.0) naturally (2.2.1) netrc (0.11.0) no_proxy_fix (0.1.2) - nokogiri (1.14.2) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.2) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - octokit (5.6.1) + octokit (6.1.1) faraday (>= 1, < 3) sawyer (~> 0.9) open4 (1.3.4) optparse (0.1.1) os (1.1.4) - ox (2.14.14) + ox (2.14.16) plist (3.7.0) public_suffix (4.0.7) - racc (1.6.2) + racc (1.7.0) rake (13.0.6) rchardet (1.8.0) representable (3.2.0) diff --git a/Sources/StringStyle+Part.swift b/Sources/StringStyle+Part.swift index a2845d51..18189391 100644 --- a/Sources/StringStyle+Part.swift +++ b/Sources/StringStyle+Part.swift @@ -157,8 +157,6 @@ extension StringStyle { return style } - // swiftlint:disable function_body_length - // swiftlint:disable cyclomatic_complexity /// Update the style with the specified style part. /// /// - Parameter stylePart: The style part with which to update the receiver. @@ -273,7 +271,4 @@ extension StringStyle { #endif } } - // swiftlint:enable function_body_length - // swiftlint:enable cyclomatic_complexity - } diff --git a/Tests/AdaptiveStyleTests.swift b/Tests/AdaptiveStyleTests.swift index 9b8752b7..9039dc74 100644 --- a/Tests/AdaptiveStyleTests.swift +++ b/Tests/AdaptiveStyleTests.swift @@ -17,7 +17,6 @@ import XCTest let defaultTraitCollection = UITraitCollection(preferredContentSizeCategory: UIContentSizeCategory.large) // These tests rely on iOS 10.0 APIs. Test method needs to be updated to run on iOS 9.0 -// swiftlint:disable type_body_length @available(iOS 10.0, *) class AdaptiveStyleTests: XCTestCase { @@ -292,7 +291,6 @@ class AdaptiveStyleTests: XCTestCase { } } } - // swiftlint:enable function_body_length func testTabAdaptation() { func firstTabLocation(attributedString string: NSAttributedString) -> CGFloat { diff --git a/Tests/AssertHelpers.swift b/Tests/AssertHelpers.swift index 45eda6e2..38741b8c 100644 --- a/Tests/AssertHelpers.swift +++ b/Tests/AssertHelpers.swift @@ -26,7 +26,7 @@ func BONAssert(attributes dictionary: StyleAttributes?, key: NSAtt XCTFail("value is not of expected type", file: file, line: line) return } - XCTAssert(dictionaryValue == value, "\(key): \(dictionaryValue) != \(value)", file: file, line: line) + XCTAssertEqual(dictionaryValue, value, "\(key): \(dictionaryValue) != \(value)", file: file, line: line) } func BONAssertColor(inAttributes dictionary: StyleAttributes?, key: NSAttributedString.Key, color controlColor: BONColor, file: StaticString = #filePath, line: UInt = #line) { diff --git a/Tests/AttributedStringStyleTests.swift b/Tests/AttributedStringStyleTests.swift index aa7fd901..fbe5dbc4 100644 --- a/Tests/AttributedStringStyleTests.swift +++ b/Tests/AttributedStringStyleTests.swift @@ -10,8 +10,6 @@ import CoreText import XCTest -// swiftlint:disable file_length -// swiftlint:disable:next type_body_length class StringStyleTests: XCTestCase { override func setUp() { @@ -881,5 +879,3 @@ private extension StringStyleTests { } } - -// swiftlint:enable file_length diff --git a/Tests/FontInspectorTests.swift b/Tests/FontInspectorTests.swift index 90ed5855..2574477f 100644 --- a/Tests/FontInspectorTests.swift +++ b/Tests/FontInspectorTests.swift @@ -30,7 +30,6 @@ class FontInspectorTests: XCTestCase { XCTAssertFalse(systemFont.has(feature: NumberCase.lower)) } - // swiftlint:disable function_body_length /// This test is disabled on macOS because, although it works locally, /// the font reports _slightly_ different feature availability on the build /// machine. Perhaps it is installed on the build machine? Possible fix: use @@ -123,6 +122,4 @@ class FontInspectorTests: XCTestCase { ].joined(separator: "\n") XCTAssertEqual(garamond.availableFontFeatures(includeIdentifiers: false), garamondControlString) } - // swiftlint:enable function_body_length - } diff --git a/Tests/XMLTagStyleBuilderTests.swift b/Tests/XMLTagStyleBuilderTests.swift index baae1ebf..b20efa86 100644 --- a/Tests/XMLTagStyleBuilderTests.swift +++ b/Tests/XMLTagStyleBuilderTests.swift @@ -39,7 +39,7 @@ class XMLTagStyleBuilderTests: XCTestCase { let fonts: [String: BONFont] = attributedString.rangesFor(attribute: NSAttributedString.Key.font.rawValue) BONAssertEqualFonts(BONFont(name: "Avenir-Roman", size: 30)!, fonts["8:7"]!) BONAssertEqualFonts(BONFont(name: "Avenir-Roman", size: 20)!, fonts["25:7"]!) - XCTAssert(fonts.count == 2) + XCTAssertEqual(fonts.count, 2) } func testUnicodeInXML() { @@ -60,7 +60,7 @@ class XMLTagStyleBuilderTests: XCTestCase { let fonts: [String: BONFont] = attributedString.rangesFor(attribute: NSAttributedString.Key.font.rawValue) BONAssertEqualFonts(BONFont(name: "Avenir-Roman", size: 30)!, fonts["8:7"]!) BONAssertEqualFonts(BONFont(name: "Avenir-Roman", size: 20)!, fonts["25:7"]!) - XCTAssert(fonts.count == 2) + XCTAssertEqual(fonts.count, 2) } /// Verify the behavior when a style is not registered @@ -77,7 +77,7 @@ class XMLTagStyleBuilderTests: XCTestCase { let attributedString = style.attributedString(from: "This style is not registered and that's OK") XCTAssertEqual("This style is not registered and that's OK", attributedString.string) let fonts: [String: BONFont] = attributedString.rangesFor(attribute: NSAttributedString.Key.font.rawValue) - XCTAssert(fonts.count == 0) + XCTAssertEqual(fonts.count, 0) } func testInvalidXMLByStyle() { @@ -86,7 +86,7 @@ class XMLTagStyleBuilderTests: XCTestCase { let attributedString = style.attributedString(from: "This style has no closing tag and that is :(") XCTAssertEqual("This style has no closing tag and that is :(", attributedString.string) let fonts: [String: BONFont] = attributedString.rangesFor(attribute: NSAttributedString.Key.font.rawValue) - XCTAssert(fonts.count == 0) + XCTAssertEqual(fonts.count, 0) } /// Verify that the string is read when fully contained