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

Fix Lint/AmbiguousOperator warnings #1021 #1022

Closed
wants to merge 1 commit into from

Conversation

hotovson
Copy link
Contributor

@hotovson hotovson commented Sep 16, 2016

fix part of #1021

@mattwynne
Copy link
Member

So, this might we one we need to discuss @cucumber/cucumber-ruby

@tooky and I, when pairing, have developed a convention that we use parentheses when we care about the return value, and not when we don't.

I'm struggling to find the reference that inspired that style, but this article is a reference.

I am fond of this style, but I'm more interested in consistency than pushing one particular style. If this parentheses-everywhere rules is easier to check with rubocop, I can live with it.

What are other people's thoughts?

@nodo
Copy link
Member

nodo commented Sep 22, 2016

@mattwynne That is an interesting convention and I wouldn't mind to keep 👍 .

If we decided to keep the convention, it would be great to ignore these violations in the .rubocop.yml file and add a paragraph in CONTRIBUTING.md that explains the code conventions of the project.

@threedaymonk
Copy link
Contributor

@mattwynne That's the convention I've long used myself, although, like you, I can't remember where I originally drew the inspiration. I suspect it flows naturally from Ruby's precedence rules:

do_something transform(munge(a, b))

is easier to parse mentally than the equivalent but paren-less

do_something transform munge a, b

@tooky
Copy link
Member

tooky commented Sep 22, 2016

I think it's nice to use ruby's loose syntax for conventions - I remember Jim Weirich was a proponent of using {} blocks when you care about the return value and do; end when you don't.

But if we are going to have conventions like that, I like @nodo's suggestion to document them.

There are others we developed, like always returning self from commands. We should definitely write them down.

@hotovson hotovson force-pushed the 1021-fix-style-violations branch from df64988 to 4e691d7 Compare September 23, 2016 08:01
@hotovson
Copy link
Contributor Author

rebased to current master

@nodo
Copy link
Member

nodo commented Sep 23, 2016

As previously suggested by @brasmusson in this comment I changed the PR message to "fix part of #1021" to inhibit Github to automatically close the related issue.

@hotovson
Copy link
Contributor Author

@nodo can you re-run Travis CI tests? it seems false negative

@mattwynne
Copy link
Member

I agree we should at least document this. I don't suppose there's a way to actually get the linter to check for that convention is there?

@nodo
Copy link
Member

nodo commented Sep 25, 2016

@hotovson thanks for your work, I have restarted the CI tests and indeed it was a false negative.

@mattwynne unfortunately I don't think there is a easy way to get rubocop check some custom conventions. I will have a deeper look.

@hotovson
Copy link
Contributor Author

@nodo @mattwynne IMHO the only way is by custom cops

@mattwynne
Copy link
Member

So what's the consensus with this one @cucumber/cucumber-ruby? I hate to waste @hotovson's good work, but it does seem as though a documented convention would work better in this instance, rather than a hard style check. Do we agree?

@mattwynne
Copy link
Member

OK I'm closing this one rather than merging. I feel bad about your efforts @hotovson but I hope you understand.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants