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

Enforce an empty line after render(:partail) and return #7795

Closed
fidalgo opened this issue Mar 12, 2020 · 1 comment · Fixed by #7796
Closed

Enforce an empty line after render(:partail) and return #7795

fidalgo opened this issue Mar 12, 2020 · 1 comment · Fixed by #7796

Comments

@fidalgo
Copy link

fidalgo commented Mar 12, 2020

In the following line
render(:partial) and return (if/unless condition) it would be nice to have a cop to enforce an empty line, the same way we have with:
return .... if

@koic
Copy link
Member

koic commented Mar 12, 2020

Perhaps it can be generalized to do_something(...) and return if condition.
I think this can be suggested to RuboCop core as an extension to Layout/EmptyLineAfterGuardClause cop.

@koic koic transferred this issue from rubocop/rubocop-rails Mar 12, 2020
koic added a commit to koic/rubocop that referenced this issue Mar 12, 2020
…return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
koic added a commit to koic/rubocop that referenced this issue Mar 12, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
koic added a commit to koic/rubocop that referenced this issue Mar 12, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
koic added a commit to koic/rubocop that referenced this issue Mar 13, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
koic added a commit to koic/rubocop that referenced this issue Mar 13, 2020
koic added a commit to koic/rubocop that referenced this issue Mar 13, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
koic added a commit to koic/rubocop that referenced this issue Mar 18, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
koic added a commit to koic/rubocop that referenced this issue Mar 19, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
koic added a commit that referenced this issue Mar 19, 2020
…_aware_of_and_return

[Fix #7795] Make `Layout/EmptyLineAfterGuardClause` aware of `and return`
ty-porter pushed a commit to ty-porter/rubocop that referenced this issue Mar 21, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
Neodelf pushed a commit to Neodelf/rubocop that referenced this issue Apr 28, 2020
…and return`

Resolves rubocop#7795.

This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`.

It was proposed based on the following code controlled by Rails
controller.

```ruby
render :foo and return if condition

do_something
```

I think that it can be generalized as a control flow.

```ruby
foo(arg) and return if condition

do_something
```

So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants