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

KtLint Auto-formatting #444

Merged
merged 2 commits into from
Jul 10, 2024
Merged

KtLint Auto-formatting #444

merged 2 commits into from
Jul 10, 2024

Conversation

shubertm
Copy link
Member

🚀 Summary

Configure ktlint to use auto formatting after format violations checks
Issue:

🖼️ Screenshots:

Provide screenshots to make it visible to reviewer if possible (Optional)

Before After
Screenshot_1 Screenshot_2

@hieuwu
Copy link
Collaborator

hieuwu commented Jun 23, 2024

Great work. Could you please also document how to use it?

@shubertm
Copy link
Member Author

Great work. Could you please also document how to use it?

Alright, btw how are we keeping the documentation? I heard you documenting something too

@kirillt
Copy link
Member

kirillt commented Jun 27, 2024

@shubertm I think @hieuwu means some instructions in README if anything needs to be run manually by a developer.

But my understanding is that Gradle will run ktlint automatically, right?

@shubertm
Copy link
Member Author

@shubertm I think @hieuwu means some instructions in README if anything needs to be run manually by a developer.

But my understanding is that Gradle will run ktlint automatically, right?

Yes, it will fix all of our formatting style violations automatically, good for new developers not to worry about code formatting errors. We did this in Retouch too. And @kirillt I was thinking if we could have this in all Kotlin repos?
@hieuwu I think there is nothing a dev is supposed to do manually.

Copy link
Collaborator

@hieuwu hieuwu left a comment

Choose a reason for hiding this comment

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

Looks good. Later, do you think we can have a hook with the coding convention? Like before commit or push event, we will run check then notify in the terminal so that developer can fix their own before the code is pushed

@shubertm
Copy link
Member Author

shubertm commented Jul 3, 2024

Looks good. Later, do you think we can have a hook with the coding convention? Like before commit or push event, we will run check then notify in the terminal so that developer can fix their own before the code is pushed

Yeah, earlier we had that pre-commit scripts. I will see about it. It's really important because sometimes auto format misses some

Copy link

sonarcloud bot commented Jul 7, 2024

Copy link
Collaborator

@hieuwu hieuwu left a comment

Choose a reason for hiding this comment

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

Looks good.
Rad LGTM

@shubertm
Copy link
Member Author

Looks good.
Rad LGTM

I think later we should add pre-commit hook for Windows too

@shubertm shubertm merged commit f554422 into main Jul 10, 2024
7 checks passed
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