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 configuration for semicolon_block lints #10656

Merged
merged 11 commits into from
Apr 25, 2023
Merged

Conversation

Centri3
Copy link
Member

@Centri3 Centri3 commented Apr 17, 2023

Does exactly what it says on the tin, suggests moving a block's final semicolon inside if it's multiline and outside if it's singleline.

I don't really like how this is implemented so I'm not too sure if this is ready yet. Alas, it might be ok.


fixes #10654

changelog: Enhancement: [semicolon_inside_block]: Added semicolon-inside-block-ignore-singleline as a new config value.
#10656
changelog: Enhancement: [semicolon_outside_block]: Added semicolon-outside-block-ignore-multiline as a new config value.
#10656

@rustbot
Copy link
Collaborator

rustbot commented Apr 17, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @xFrednet (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Apr 17, 2023
@Centri3
Copy link
Member Author

Centri3 commented Apr 17, 2023

I think I will rewrite this later. I created this while half-asleep and so it's a bit more of a hacky solution than I'd like 🙂 It works currently but could be cleaner.

@xFrednet
Copy link
Member

Hey! Code written in the half-asleep state can be quite genius. At least there are quite a few PRs I created in that state which weren't too bad ^^. I planned to do a review of this on Wednesday, is that fine with you, or should I wait on the planned rewrite :)

@Centri3
Copy link
Member Author

Centri3 commented Apr 17, 2023

Hey! Code written in the half-asleep state can be quite genius. At least there are quite a few PRs I created in that state which weren't too bad ^^. I planned to do a review of this on Wednesday, is that fine with you, or should I wait on the planned rewrite :)

Wednesday sounds good, I think I can get it done by then. Thanks!

e: Disregard this 😅 I think I may just refactor instead.

Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

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

The implementation overall looks good to me. I left two comments, where I would like your feedback on.

Also, because I didn't say that earlier: Welcome to Clippy 👋 📎

clippy_lints/src/semicolon_block.rs Outdated Show resolved Hide resolved
clippy_lints/src/declared_lints.rs Outdated Show resolved Hide resolved
@Centri3 Centri3 changed the title Add semicolon_outside_block_if_singleline lint Add configuration for semicolon_block lints Apr 20, 2023
@xFrednet xFrednet self-requested a review April 21, 2023 16:00
Copy link
Member

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

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

This generally looks good to me, some nits and a few questions to make sure, that I understand everything correctly :)

clippy_lints/src/utils/conf.rs Outdated Show resolved Hide resolved
clippy_lints/src/semicolon_block.rs Outdated Show resolved Hide resolved
@xFrednet
Copy link
Member

Looks good to me, thank you for the update and addressing all my review comments. I hope you had fun working on Clippy :D

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 25, 2023

📌 Commit e3ee10d has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Apr 25, 2023

⌛ Testing commit e3ee10d with merge 22e2bd8...

bors added a commit that referenced this pull request Apr 25, 2023
Add configuration for `semicolon_block` lints

Does exactly what it says on the tin, suggests moving a block's final semicolon inside if it's multiline and outside if it's singleline.

I don't really like how this is implemented so I'm not too sure if this is ready yet. Alas, it might be ok.

---

fixes #10654

changelog: Enhancement: [`semicolon_inside_block`]: Added `semicolon-inside-block-ignore-singleline` as a new config value.
[#10656](#10656)
changelog: Enhancement: [`semicolon_outside_block`]: Added `semicolon-outside-block-ignore-multiline` as a new config value.
[#10656](#10656)
<!-- changelog_checked -->
@bors
Copy link
Collaborator

bors commented Apr 25, 2023

💔 Test failed - checks-action_test

@Centri3
Copy link
Member Author

Centri3 commented Apr 25, 2023

whoops, forgot to run cargo collect-metadata 😅 I think you'll need to reapprove this, @xFrednet

@xFrednet
Copy link
Member

Yes, that's what the CI is for. Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 25, 2023

📌 Commit 8c8cf40 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Apr 25, 2023

⌛ Testing commit 8c8cf40 with merge 990bbdc...

@bors
Copy link
Collaborator

bors commented Apr 25, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 990bbdc to master...

@bors bors merged commit 990bbdc into rust-lang:master Apr 25, 2023
blyxyas added a commit to blyxyas/rust-clippy that referenced this pull request Apr 25, 2023
blyxyas added a commit to blyxyas/rust-clippy that referenced this pull request May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new lint for the location of a semicolon depending on whether its block is singleline or multiline
4 participants