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

Use Rufo in GraphQL-Ruby #1800

Closed
wants to merge 1 commit into from
Closed

Use Rufo in GraphQL-Ruby #1800

wants to merge 1 commit into from

Conversation

rmosolgo
Copy link
Owner

I'm interested in using https://github.com/ruby-formatter/rufo to standardize style, I wonder how it will work in this project.

@rmosolgo rmosolgo self-assigned this Aug 22, 2018
@@ -12,7 +13,7 @@ module Analysis
#
class MaxQueryDepth < GraphQL::Analysis::QueryDepth
def initialize(max_depth)
disallow_excessive_depth = ->(query, depth) {
disallow_excessive_depth = -> (query, depth) {
Copy link
Owner Author

Choose a reason for hiding this comment

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

The no-space Procs were originially introduced because someone wanted to support Ruby 1.9. AFAIK they gave up, and don't actually use GraphQL-Ruby after all. So this will be a big change, but probably OK.

"... and 1 more line\n"
else
"... and #{cause_backtrace_remainder_length} more lines\n"
end
Copy link
Owner Author

Choose a reason for hiding this comment

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

Personally I don't like it but w/e

enum Enum {
VALUE
}
""")
" "")
Copy link
Owner Author

Choose a reason for hiding this comment

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

Wow, I guess this is just a funny bug? I think the person was imagining Python or GraphQL triple-quotes, and it happened to work because of a rarely-used string concatenation feature:

$ irb
irb(main):001:0> "abc" "def"
# => "abcdef"

Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 ruby strings aren't multiline by default though, so how would this work?

Copy link
Owner Author

Choose a reason for hiding this comment

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

irb(main):002:0> "" "some stuff
irb(main):003:0" is here" ""
=> "some stuff \nis here"

Equivalent to:

irb(main):004:0> "some stuff
irb(main):005:0" is here"
=> "some stuff \nis here"

@phaedryx
Copy link
Contributor

I'm not familiar with Rufo, but it looks like a more opinionated Rubocop?

Is there a reason you prefer this over Rubocop?

@rmosolgo
Copy link
Owner Author

prefer this

only because @asterite made it 😆

Yeah, I'm not too crazy about its indentation rules, so I think I may just lean more on Rubocop instead.

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