Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

#59 — Update errors #63

Merged

Conversation

rockfridrich
Copy link
Member

@rockfridrich rockfridrich commented Feb 25, 2018

Closes #59
This PR implements DescribedError protocol for errors in classes described in the related issue.

@0crat 0crat added the scope label Feb 25, 2018
@0crat
Copy link

0crat commented Feb 25, 2018

Job #63 is now in scope, role is REV

@0crat
Copy link

0crat commented Feb 25, 2018

This pull request #63 is assigned to @driver733/z, here is why. The budget is 15 minutes, see §4. Please, read §27 and when you decide to accept the changes, inform @Biboran/z (the architect) right in this ticket. If you decide that this PR should not be accepted ever, also inform the architect.

@rockfridrich
Copy link
Member Author

rockfridrich commented Feb 25, 2018

Codecov Report

Merging #63 into develop will increase coverage by 0.56%.
The diff coverage is 96.92%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #63      +/-   ##
===========================================
+ Coverage    92.37%   92.94%   +0.56%     
===========================================
  Files           59       58       -1     
  Lines         1509     1545      +36     
  Branches        26       24       -2     
===========================================
+ Hits          1394     1436      +42     
+ Misses         115      109       -6
Impacted Files Coverage Δ
Web3Swift/Hex/SimpleHex.swift 100% <100%> (ø) ⬆️
Web3Swift/Params/TransactionHashParameter.swift 100% <100%> (ø) ⬆️
Web3Swift/Extensions/URLSession.swift 100% <100%> (+9.67%) ⬆️
Web3Swift/Address/SimpleAddress.swift 85% <100%> (+15%) ⬆️
Example/Tests/Params/AddressParameterTests.swift 100% <100%> (ø) ⬆️
Example/Tests/Network/GethNetworkTests.swift 100% <100%> (ø) ⬆️
Web3Swift/Network/GethNetwork.swift 96.22% <88.88%> (+1.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d338df8...4c9e929. Read the comment docs.

@@ -50,8 +50,8 @@ class GethNetworkTests: XCTestCase {
expect{
try GethNetwork(ip: "127.0.0.1", port: "8545", isSecureConnection: true)
Copy link
Contributor

@driver733 driver733 Feb 25, 2018

Choose a reason for hiding this comment

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

@rockfridrich
As per Contributing.md
Please put all constant values as object properties.

Copy link
Member Author

@rockfridrich rockfridrich Feb 25, 2018

Choose a reason for hiding this comment

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

This will make test less readable

Copy link
Contributor

@driver733 driver733 Feb 25, 2018

Choose a reason for hiding this comment

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

@rockfridrich I think that it is right the opposite way.
Please read this.
cc @Biboran

Copy link
Member Author

@rockfridrich rockfridrich Feb 25, 2018

Choose a reason for hiding this comment

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

Depends :)
I agree that we need to place repeated constants somewhere else. I don't know which concept can be used for this. If something is used in one particular test function only then we don't need to place it somewhere in the top of the file.

@@ -5,7 +5,19 @@
import CryptoSwift
import Foundation

public final class InvalidAddressLengthError: Swift.Error { }
public final class IncorrectAddressLengthError: DescribedError {
Copy link
Contributor

Choose a reason for hiding this comment

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

@rockfridrich Please provide documentation for this class.

@@ -11,7 +23,7 @@ public final class TransactionHashParameter: GethParameter {
}

public func value() throws -> Any {
guard transactionHash.toString().count == 64 else { throw InvalidTransactionHashError() }
guard transactionHash.toString().count == 64 else { throw IncorrectTransactionHashLengthError(length: transactionHash.toString().count) }
Copy link
Contributor

Choose a reason for hiding this comment

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

@rockfridrich
Please limit line length to 80 chars.
We should have a swiftlint rule to enforce that (cc @Biboran )

@driver733
Copy link
Contributor

driver733 commented Feb 25, 2018

@rockfridrich Please provided a proper PR description that shows what problem you have fixed an how.

@rockfridrich
Copy link
Member Author

@Biboran @driver733 I have moved all constants to private class variables. Should we use this conversation in all tests?

@driver733
Copy link
Contributor

@rockfridrich Yes. Also, please rename all constants to the following signature, as per CONTRIBUTING.md

3. Constant values that are used in the test follow this structure
     
     private let CONTANT: SomeType = "Some test value for test purposes."
     

@rockfridrich
Copy link
Member Author

@driver733 uppercase makes multipal words variable unreadable.
screen shot 2018-02-25 at 22 38 49

@driver733
Copy link
Contributor

@rockfridrich Use underscore. Here's an example.
private let USER_ID: Int = 1

@rockfridrich
Copy link
Member Author

@Biboran @driver733 let's adjust swiftlint for such convention
screen shot 2018-02-25 at 22 54 03

@rockfridrich
Copy link
Member Author

Return tests back to previous state

@rockfridrich
Copy link
Member Author

@Biboran @driver733 could we merge this?

@driver733
Copy link
Contributor

@Biboran ping

@abdulowork abdulowork merged commit 18d6c4a into zeriontech:develop Mar 1, 2018
@zeriontech zeriontech deleted a comment from 0crat Mar 1, 2018
@0crat
Copy link

0crat commented Mar 2, 2018

@driver733/z this job was assigned to you 5 days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please.

@driver733
Copy link
Contributor

@0crat refuse

@0crat
Copy link

0crat commented Mar 2, 2018

@0crat refuse (here)

@driver733 The user @driver733/z resigned from #63, please stop working. Reason for job resignation: Order was cancelled

@0crat
Copy link

0crat commented Mar 2, 2018

Tasks refusal is discouraged, see §6: -15 points just awarded to @driver733/z

@0crat 0crat removed the scope label Mar 10, 2018
@0crat
Copy link

0crat commented Mar 10, 2018

The job #63 is now out of scope

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants