Skip to content

Commit

Permalink
Merge pull request #431 from Rightpoint/tidying
Browse files Browse the repository at this point in the history
Tidying
  • Loading branch information
ZevEisenberg authored Jun 12, 2023
2 parents becf396 + 9f6ce05 commit 001139a
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 62 deletions.
14 changes: 7 additions & 7 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion BonMot.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions Example-iOS/DemoStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import UIKit

typealias StringStyle = BonMot.StringStyle

// swiftlint:disable type_body_length file_length
enum DemoStrings {

// A Simple Example
Expand Down Expand Up @@ -436,7 +435,6 @@ enum DemoStrings {
}()

}
// swiftlint:enable type_body_length

extension DemoStrings {

Expand All @@ -451,5 +449,3 @@ extension DemoStrings {
}

}

// swiftlint:enable file_length
62 changes: 31 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ 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)
json (>= 1.5.1)
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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -238,41 +238,41 @@ 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)
kramdown (~> 2.0)
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)
Expand Down
5 changes: 0 additions & 5 deletions Sources/StringStyle+Part.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -273,7 +271,4 @@ extension StringStyle {
#endif
}
}
// swiftlint:enable function_body_length
// swiftlint:enable cyclomatic_complexity

}
2 changes: 0 additions & 2 deletions Tests/AdaptiveStyleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -292,7 +291,6 @@ class AdaptiveStyleTests: XCTestCase {
}
}
}
// swiftlint:enable function_body_length

func testTabAdaptation() {
func firstTabLocation(attributedString string: NSAttributedString) -> CGFloat {
Expand Down
2 changes: 1 addition & 1 deletion Tests/AssertHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func BONAssert<T: Equatable>(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) {
Expand Down
4 changes: 0 additions & 4 deletions Tests/AttributedStringStyleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import CoreText
import XCTest

// swiftlint:disable file_length
// swiftlint:disable:next type_body_length
class StringStyleTests: XCTestCase {

override func setUp() {
Expand Down Expand Up @@ -881,5 +879,3 @@ private extension StringStyleTests {
}

}

// swiftlint:enable file_length
3 changes: 0 additions & 3 deletions Tests/FontInspectorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -123,6 +122,4 @@ class FontInspectorTests: XCTestCase {
].joined(separator: "\n")
XCTAssertEqual(garamond.availableFontFeatures(includeIdentifiers: false), garamondControlString)
}
// swiftlint:enable function_body_length

}
8 changes: 4 additions & 4 deletions Tests/XMLTagStyleBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand All @@ -77,7 +77,7 @@ class XMLTagStyleBuilderTests: XCTestCase {
let attributedString = style.attributedString(from: "This <B>style</B> 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() {
Expand All @@ -86,7 +86,7 @@ class XMLTagStyleBuilderTests: XCTestCase {
let attributedString = style.attributedString(from: "This <B>style has no closing tag and that is :(")
XCTAssertEqual("This <B>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
Expand Down

0 comments on commit 001139a

Please sign in to comment.