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

Give // the same binaryop whitespace exception as ^ #288

Merged
merged 2 commits into from
Sep 13, 2020

Conversation

nickrobinson251
Copy link
Contributor

As mentioned in #283, BlueStyle recommends exempting both ^ and // from the rule that binary operators are surrounded by whitespace. a ^ b is already formatted as a^b. This PR adds the analogous formatting x // y -> x//y.

Since x//y is a single Rational number, i think this makes sense as a general rule, so i've added it to the DefaultStyle - does that seem reasonable?

This is my first attempt at making contributions to the code in the package, so please let me know if this approach seems right 😄 Hopefully tests show the intended behaviour

CSTParser.RationalOp,
CSTParser.PowerOp,
CSTParser.DeclarationOp,
CSTParser.DotOp,
Copy link
Contributor Author

@nickrobinson251 nickrobinson251 Sep 12, 2020

Choose a reason for hiding this comment

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

I changed (8, 13, 14, 16) -> (CSTParser.ColonOp, CSTParser.PowerOp, CSTParser.DeclarationOp, CSTParser.DotOp) since it took me quite a while to work out what these mystery numbers were. I think the additional verbosity is worth it. Then i've added RationalOp to catch the // case.

Copy link
Owner

@domluna domluna left a comment

Choose a reason for hiding this comment

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

makes sense, thanks for adding it.

@domluna domluna merged commit 7ece8a2 into domluna:master Sep 13, 2020
@nickrobinson251 nickrobinson251 deleted the npr/FwdFwdSlash branch September 13, 2020 21:49
@nickrobinson251 nickrobinson251 mentioned this pull request Sep 13, 2020
36 tasks
domluna added a commit that referenced this pull request Sep 23, 2020
domluna added a commit that referenced this pull request Sep 23, 2020
* make #288 only used in BlueStyle

* fmt
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.

2 participants