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

Add multiline-loop to complement multiline-if-else #2298

Merged
merged 4 commits into from
Nov 16, 2023
Merged

Add multiline-loop to complement multiline-if-else #2298

merged 4 commits into from
Nov 16, 2023

Conversation

hanggrian
Copy link
Contributor

@hanggrian hanggrian commented Oct 9, 2023

Description

Related to #2223.

Added MultiLineLoopRule that, like MultiLineIfElseRule, checks violation in for, while, and do statements.

Checklist

Before submitting the PR, please check following (checks which are not relevant may be ignored):

  • Commit message are well written. In addition to a short title, the commit message also explain why a change is made.
  • At least one commit message contains a reference Closes #<xxx> or Fixes #<xxx> (replace<xxx> with issue number)
  • Tests are added
  • KtLint format has been applied on source code itself and violations are fixed
  • CHANGELOG.md is updated
  • PR description added

Documentation is updated. See difference between snapshot and release documentation

@paul-dingemans
Copy link
Collaborator

Tnx for your contribution. I will have a look after 1.0.1 is released. Functional change like a new rule have to wait to next minor release.

@paul-dingemans paul-dingemans added this to the 1.1 milestone Oct 10, 2023
@hanggrian
Copy link
Contributor Author

Hi Paul. I understand, thanks for your response. And also for pointing out the bracing difference between Kotlin and Android style guides.

Copy link
Collaborator

@paul-dingemans paul-dingemans left a comment

Choose a reason for hiding this comment

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

Well done! I see that you picked up quite some conventions of the project. Please address the remarks.

CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines 28 to 30
for (i in 1..10) return 0
while (true) return 0
do return 0 while (true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

According to Android style guide:

Braces are otherwise required for any if, for, when branch, do, and while statements and expressions, even when the body is empty or contains only a single statement.

Kotlin style guide does not mention it explicitly, but I am fine with imposing this on code styles.

@paul-dingemans paul-dingemans merged commit 05aa8a0 into pinterest:master Nov 16, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants