-
Notifications
You must be signed in to change notification settings - Fork 128
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
Implement the API endpoint for listing releases #116
Conversation
func listReleases(_ session: RequestKitURLSession = URLSession.shared, owner: String, repository: String, completion: @escaping (_ response: Response<[Release]>) -> Void) -> URLSessionDataTaskProtocol? { | ||
let router = ReleaseRouter.listReleases(configuration, owner, repository) | ||
return router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: [Release].self) { releases, error in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diffs aren't automatically wrapped everywhere, so please avoid long lines, as it makes the code harder to review on devices without a wide screen. 100-120 characters line limit should be sufficient in most cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we should limit the lines to some amount of characters. I don’t know if 100-120 is the correct number but it should be enforced with some swiftformat/swiftlint rules so it applies everywhere for everyone.
I personally wouldn’t leave this as a mandatory change to get this PR accepted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MaxDesiatov this should do the job: https://realm.github.io/SwiftLint/line_length.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm aware of this one, and SwiftFormat recently also gained an ability to fit code into given line length too 🙂
("testPostRelease", testPostRelease), | ||
("testLinuxTestSuiteIncludesAllTests", testLinuxTestSuiteIncludesAllTests) | ||
] | ||
|
||
// MARK: Actual Request tests | ||
|
||
func testListReleases() { | ||
let session = OctoKitURLTestSession(expectedURL: "https://api.github.com/repos/octocat/Hello-World/releases", expectedHTTPMethod: "GET", jsonFile: "Fixtures/releases", statusCode: 200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: please split this to multiple lines to reduce the length of this line for easier review.
@MaxDesiatov I'm ready to split long lines, but if I do that, it will be different style from other lines. |
Maybe some formatting rules applied with SwiftFormat could be introduced in a separate PR? I'll defer to @AvdLee on this matter |
Thanks a lot! |
Implement the API endpoint for listing releases
Implements the API endpoint to list releases on a GitHub repository.
Also fixes some properties which will be
null
when the draft release is returned from API.