Skip to content
代码片段 群组 项目
未验证 提交 1c5106fa 编辑于 作者: Rémy Coutable's avatar Rémy Coutable
浏览文件

Allow comment after if/unless clause


Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
上级 2b8eb727
No related branches found
No related tags found
无相关合并请求
...@@ -95,7 +95,7 @@ def start_clause_line?(line) ...@@ -95,7 +95,7 @@ def start_clause_line?(line)
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)
......
...@@ -256,6 +256,18 @@ def a_method ...@@ -256,6 +256,18 @@ def a_method
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
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册