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

Switch to spotless and format code #1196

Merged
merged 4 commits into from
Aug 28, 2020
Merged

Conversation

ZacSweers
Copy link
Collaborator

@ZacSweers ZacSweers commented Aug 28, 2020

After merging, I can make a second PR setting up the format commit as an ignored revision to better protect history

Note that I haven't enabled licenses yet because there seems to be a bug in Spotless where it always overwrites the copyright year even if we had one set. diffplug/spotless#677

@nedtwigg
Copy link

I might pause on merging this for a moment to evaluate ratchetFrom 'origin/main', I'll explain in the issue you raised on Spotless. Moshi is great btw, thanks!

Copy link
Collaborator

@swankjesse swankjesse left a comment

Choose a reason for hiding this comment

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

It’s far from perfect, but I also don’t want to care about whitespace.

@JakeWharton any feels?

* friendly than using SimpleDateFormat so highly suitable if you (un)serialize lots of date
* objects.
*
* Supported parse format: [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh[:]mm]]
* <p>Supported parse format:
* [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh[:]mm]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

this one’s weird

Copy link
Collaborator

Choose a reason for hiding this comment

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

jshell> " * Supported parse format: [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh[:]mm]]".length()
$1 ==> 101

public void fromJson() throws IOException {
Moshi moshi =
new Moshi.Builder()
.add(
Copy link
Collaborator

Choose a reason for hiding this comment

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

ew

Copy link
Collaborator

Choose a reason for hiding this comment

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

qualifiers = prop.annotations.mapTo(mutableSetOf()) { it.className }
)
}
.asSequence()
Copy link
Collaborator

Choose a reason for hiding this comment

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

still should be +4 on wrapped lines, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ktlint doesn't support continuation indent anymore, and the compose and kotlin people sold me recently on it being a "you get used to it" thing. The kotlin plugin is iffy on its support of it too

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep, you won't notice in a week.

}
}).add(new UppercaseAdapterFactory()).build();
@Test
public void toAndFromWithIntermediateWithQualifier() throws Exception {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is strictly worse

Copy link
Collaborator

Choose a reason for hiding this comment

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

@swankjesse
Copy link
Collaborator

Also please don’t address my feedback above; I’m just ranting at bad choices made by the formatter

@JakeWharton
Copy link
Collaborator

:shipit:. Switched over Retrofit a while ago and I don't care. Same for using ktlint on a bunch of projects. Whevs.

@swankjesse swankjesse merged commit 538890e into square:master Aug 28, 2020
@swankjesse
Copy link
Collaborator

SGTM. Thanks Zach!

@ZacSweers ZacSweers deleted the z/format branch August 28, 2020 03:46
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.

4 participants