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

fix: indent consistency of multiline-format #96

Merged
merged 7 commits into from
Mar 24, 2020
Merged

Conversation

YusukeHosonuma
Copy link
Owner

@YusukeHosonuma YusukeHosonuma commented Mar 22, 2020

resolved #95

TODO

  • fix indent consistency
  • refactor
  • update Example
  • update README

@codecov-io
Copy link

codecov-io commented Mar 22, 2020

Codecov Report

Merging #96 into master will increase coverage by 0.20%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   77.39%   77.60%   +0.20%     
==========================================
  Files           9        9              
  Lines         323      326       +3     
==========================================
+ Hits          250      253       +3     
  Misses         73       73              
Impacted Files Coverage Δ
Sources/Core/Formatter/MultilineFormatter.swift 100.00% <100.00%> (ø)
Sources/Public/Debug.swift 75.67% <100.00%> (ø)
Sources/Public/Option.swift 100.00% <100.00%> (ø)

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 167281d...dea6a34. Read the comment docs.

@@ -6,44 +6,50 @@
//

class MultilineFormatter: PrettyFormatter {
private let option: Debug.Option
private let indentSize: Int
Copy link
Owner Author

Choose a reason for hiding this comment

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

Refactor: MultilineFormatter depends on indentSize instead of Debug.Option.


init(option: Debug.Option) {
self.option = option
init(indentSize: Int) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Refactor: rename to indentSize from indent because the name indent is ambiguous.

}

func collectionString(elements: [String]) -> String {
"""
let contents = elements.joined(separator: ",\n")
Copy link
Owner Author

Choose a reason for hiding this comment

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

Refactor: for consistency of code-style.

return formatter.dictionaryString(keysAndValues: keysAndValues)
}

assert(to: f, with: assertEqualLines) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

Introduce parameterized-test. But not so easy to read? 😅

Comment on lines 47 to 58
// [
// "one": Dog(id: "pochi",
// price: 10.0,
// name: "ポチ"),
// "two": Dog(id: "pochi",
// price: 10.0,
// name: "ポチ")
// "one": Dog(
// id: "pochi",
// price: 10.0,
// name: "ポチ"
// ),
// "two": Dog(
// id: "pochi",
// price: 10.0,
// name: "ポチ"
// )
// ]
Copy link
Owner Author

@YusukeHosonuma YusukeHosonuma Mar 22, 2020

Choose a reason for hiding this comment

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

I got perfectly expected behavior in Example app :)

Copy link
Collaborator

@po-miyasaka po-miyasaka left a comment

Choose a reason for hiding this comment

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

lgtm!

@YusukeHosonuma YusukeHosonuma merged commit cf7588d into master Mar 24, 2020
@YusukeHosonuma YusukeHosonuma deleted the uniform/indent branch March 24, 2020 03:14
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.

need to format indent for multi-fields-object in dictionary
3 participants