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

Hound did not recognize my single line if statement as style problem #146

Closed
mrageh opened this issue Mar 25, 2014 · 11 comments
Closed

Hound did not recognize my single line if statement as style problem #146

mrageh opened this issue Mar 25, 2014 · 11 comments
Labels

Comments

@mrageh
Copy link

mrageh commented Mar 25, 2014

Hound did not comment on my single line if statement and I believe that is a violation of the ruby style guide

number if factors.any? { |multiple| number % multiple == 0 }

mrageh/exercism#2

@mrageh mrageh changed the title single line if statement Hound did not recognize my single line if statement as style problem Mar 25, 2014
@salbertson
Copy link
Member

@Adam89, thanks for opening an issue.

@salbertson salbertson added the bug label Apr 16, 2014
@gabebw
Copy link
Contributor

gabebw commented May 1, 2014

Yup, this is still an issue, just got this comment from @houndci:

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.

That's definitely against our style guide.

@salbertson
Copy link
Member

@gabebw, would you provide the code that Hound commented on?

@gabebw
Copy link
Contributor

gabebw commented May 1, 2014

I'm not 100% sure (not my code, and a lot of commits since then), but I think this was it:

if signed_in? then redirect_to dashboard_path end

@salbertson
Copy link
Member

@gabebw, thanks. Those comments won't be created anymore.

@mrageh
Copy link
Author

mrageh commented May 2, 2014

Can we close this PR now?

@salbertson
Copy link
Member

@Adam89, not yet because we aren't checking for ternary expressions yet. I opened a pull request for RuboCop to add the check for us to use.

rubocop/rubocop#1059

@Koronen
Copy link
Contributor

Koronen commented Sep 22, 2014

@salbertson rubocop/rubocop#1059 was closed on Jun 12th. Maybe we could use the code from that PR as a custom cop that we either release as a gem, or just ship with Hound?

@gylaz
Copy link
Member

gylaz commented Sep 22, 2014

@Koronen That PR was merged into RuboCop, but there's a flaw with that cop. We should submit a PR upstream fixing it.

@thorncp
Copy link
Contributor

thorncp commented Jul 10, 2015

Looks like there has been no progress on this. To summarize the outcome of rubocop/rubocop#1059, the OneLineConditional, MultilineTernaryOperator, and TernaryOperator cops should be merged into a single cop with the 3 alternate styles. Anyone willing to take that on?

@thorncp
Copy link
Contributor

thorncp commented Sep 29, 2015

Closing for inactivity.

@thorncp thorncp closed this as completed Sep 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants