Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift 3 function names #80

Merged
merged 8 commits into from
Nov 16, 2016
Merged

Swift 3 function names #80

merged 8 commits into from
Nov 16, 2016

Conversation

mattrubin
Copy link
Owner

Update several function names to conform to the Swift 3 naming guidelines.

@mattrubin mattrubin changed the title Swift 3 naming changes Swift 3 function names Jul 28, 2016
@mattrubin mattrubin added this to the 3.0 milestone Sep 19, 2016
let recheckItem1 = try keychain.persistentTokenWithIdentifier(savedItem1.identifier)
let recheckItem2 = try keychain.persistentTokenWithIdentifier(savedItem2.identifier)
let recheckItem1 = try keychain.persistentToken(withIdentifier: savedItem1.identifier)
let recheckItem2 = try keychain.persistentToken(withIdentifier: savedItem2.identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 102 characters (line_length)

} catch {
XCTFail("deletePersistentToken(_:) failed with error: \(error)")
}

do {
let recheckItem1 = try keychain.persistentTokenWithIdentifier(savedItem1.identifier)
let recheckItem2 = try keychain.persistentTokenWithIdentifier(savedItem2.identifier)
let recheckItem1 = try keychain.persistentToken(withIdentifier: savedItem1.identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 102 characters (line_length)

let fetchedItem1 = try keychain.persistentTokenWithIdentifier(savedItem1.identifier)
let fetchedItem2 = try keychain.persistentTokenWithIdentifier(savedItem2.identifier)
let fetchedItem1 = try keychain.persistentToken(withIdentifier: savedItem1.identifier)
let fetchedItem2 = try keychain.persistentToken(withIdentifier: savedItem2.identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 102 characters (line_length)

XCTAssertEqual(savedItem1.token, token1)
XCTAssertEqual(savedItem2.token, token2)

// Fetch both tokens from the keychain
do {
let fetchedItem1 = try keychain.persistentTokenWithIdentifier(savedItem1.identifier)
let fetchedItem2 = try keychain.persistentTokenWithIdentifier(savedItem2.identifier)
let fetchedItem1 = try keychain.persistentToken(withIdentifier: savedItem1.identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 102 characters (line_length)

} catch {
XCTFail("deletePersistentToken(_:) failed with error: \(error)")
}

// Attempt to restore the deleted token
do {
let fetchedToken = try keychain.persistentTokenWithIdentifier(savedToken.identifier)
let fetchedToken = try keychain.persistentToken(withIdentifier: savedToken.identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 102 characters (line_length)

@@ -82,7 +81,7 @@ class KeychainTests: XCTestCase {

// Fetch the token again
do {
let fetchedToken = try keychain.persistentTokenWithIdentifier(savedToken.identifier)
let fetchedToken = try keychain.persistentToken(withIdentifier: savedToken.identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 102 characters (line_length)


// Restore the token
do {
let fetchedToken = try keychain.persistentTokenWithIdentifier(savedToken.identifier)
let fetchedToken = try keychain.persistentToken(withIdentifier: savedToken.identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 102 characters (line_length)

public func updatePersistentToken(_ persistentToken: PersistentToken,
withToken token: Token) throws -> PersistentToken
{
public func update(_ persistentToken: PersistentToken, with token: Token) throws -> PersistentToken {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line Length Violation: Line should be 100 characters or less: currently 105 characters (line_length)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Barely over the limit, and definitely more readable on one line.

@@ -245,7 +245,7 @@ private extension Generator {

private extension String {
/// Prepends the given character to the beginning of `self` until it matches the given length.
func paddedWithCharacter(_ character: Character, toLength length: Int) -> String {
func padded(with character: Character, toLength length: Int) -> String {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid Docs Violation: Documented declarations should be valid. (valid_docs)

@codecov-io
Copy link

codecov-io commented Nov 12, 2016

Current coverage is 94.27% (diff: 100%)

Merging #80 into swift-3 will not change coverage

@@            swift-3        #80   diff @@
==========================================
  Files             6          6          
  Lines           367        367          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits            346        346          
  Misses           21         21          
  Partials          0          0          

Powered by Codecov. Last update 8ba385a...fa65b0d

@mattrubin mattrubin mentioned this pull request Nov 12, 2016
@@ -117,7 +117,7 @@ private func urlForToken(name: String, issuer: String, factor: Generator.Factor,
return url
}

private func tokenFromURL(_ url: URL, secret externalSecret: Data? = nil) -> Token? {
private func token(from url: URL, secret externalSecret: Data? = nil) -> Token? {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Body Length Violation: Function body should span 40 lines or less excluding comments and whitespace: currently spans 46 lines (function_body_length)
Cyclomatic Complexity Violation: Function should have complexity 10 or less: currently complexity equals 13 (cyclomatic_complexity)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring these warnings, as the represent issues that already exist and aren't being exacerbated by this PR.

@mattrubin mattrubin merged commit bf452b5 into swift-3 Nov 16, 2016
@mattrubin mattrubin deleted the swift-3-api-style branch November 16, 2016 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants