Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
1c5106fa
Commit
1c5106fa
authored
May 28, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow comment after if/unless clause
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
2b8eb727
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
rubocop/cop/line_break_around_conditional_block.rb
rubocop/cop/line_break_around_conditional_block.rb
+1
-1
spec/rubocop/cop/line_break_around_conditional_block_spec.rb
spec/rubocop/cop/line_break_around_conditional_block_spec.rb
+12
-0
No files found.
rubocop/cop/line_break_around_conditional_block.rb
View file @
1c5106fa
...
@@ -95,7 +95,7 @@ module RuboCop
...
@@ -95,7 +95,7 @@ module RuboCop
end
end
def
end_clause_line?
(
line
)
def
end_clause_line?
(
line
)
line
=~
/^\s*(rescue|else|elsif|when)/
line
=~
/^\s*(
#|
rescue|else|elsif|when)/
end
end
def
begin_line?
(
line
)
def
begin_line?
(
line
)
...
...
spec/rubocop/cop/line_break_around_conditional_block_spec.rb
View file @
1c5106fa
...
@@ -256,6 +256,18 @@ describe RuboCop::Cop::LineBreakAroundConditionalBlock do
...
@@ -256,6 +256,18 @@ describe RuboCop::Cop::LineBreakAroundConditionalBlock do
expect
(
cop
.
offenses
).
to
be_empty
expect
(
cop
.
offenses
).
to
be_empty
end
end
it
"doesn't flag violation for
#{
conditional
}
followed by a comment"
do
source
=
<<~
RUBY
#{
conditional
}
condition
do_something
end
# a short comment
RUBY
inspect_source
(
source
)
expect
(
cop
.
offenses
).
to
be_empty
end
it
"doesn't flag violation for
#{
conditional
}
followed by an end"
do
it
"doesn't flag violation for
#{
conditional
}
followed by an end"
do
source
=
<<~
RUBY
source
=
<<~
RUBY
class Foo
class Foo
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment