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 codemod for splitting up 'assert a and b' #51

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

jakkdl
Copy link
Contributor

@jakkdl jakkdl commented Oct 26, 2022

Fix first task in #22

First PR to this repo, so I assume there's some doc I should update. And very possible my implementation is bad in one way or another.

I wanted to leave the comment on the first assert, or put it on a separate line before the first assert (lmk which one you prefer). Will figure out how to do that unless you're fine with it staying on the line of the last assert.

@Zac-HD
Copy link
Owner

Zac-HD commented Oct 26, 2022

The only doc to update here is the changelog, since the readme is deliberately pretty vague about details in order to make releases easier! I'm also happy to leave comments attached to the last line.

I'll likely merge this as-is after some manual testing later today 🎉

@Zac-HD Zac-HD marked this pull request as ready for review October 27, 2022 07:59
@Zac-HD Zac-HD merged commit 8ceee4b into Zac-HD:master Oct 27, 2022
@Zac-HD
Copy link
Owner

Zac-HD commented Oct 27, 2022

🤦‍♂️ immediately after merging: "I wonder what happens if you had assert a and b, 'some meaningful message'". Two more test-cases for a quick follow-up PR:

assert (
    a # comment on a
    and b  # comment on b
)
assert a and b, "avoid splitting if there's a message"

I imagine getting the comments associated with the right clauses in the first could be kinda annoying, sorry, but it's better UX!

@jakkdl
Copy link
Contributor Author

jakkdl commented Oct 27, 2022

haha, I thought it was a bit scary when you merged it immediately x)
I expected something to be broken, so no worries - will figure it out!

@jakkdl
Copy link
Contributor Author

jakkdl commented Oct 27, 2022

This is becoming a thing, but I'm onto handling

assert ( # before
        a # a_comment
        # between a&and
        and #and_comment
        # between and&b
        b # b_comment
        # after
        ) # paren_comment

which I think should cover everything possible. Thought about "just" handling simpler cases but turns out they're about as messy, heh.

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.

None yet

2 participants