File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 66AllCops :
77 DisplayCopNames : true
88 TargetRubyVersion : 2.4
9+ NewCops : enable
910 Exclude :
1011 - ' vendor/**/*'
1112 - ' spec/fixtures/**/*'
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ class AttributeDefinedStatically < Cop
3939
4040 def on_block ( node )
4141 attributes = factory_attributes ( node ) || [ ]
42- attributes = [ attributes ] unless attributes . is_a? ( Array )
42+ attributes = [ attributes ] unless attributes . is_a? ( Array ) # rubocop:disable Style/ArrayCoercion, Lint/RedundantCopDisableDirective
4343
4444 attributes . each do |attribute |
4545 next unless offensive_receiver? ( attribute . receiver , node )
Original file line number Diff line number Diff line change @@ -49,9 +49,10 @@ def on_send(node)
4949
5050 def autocorrect ( corrector , node )
5151 replacement = 'expect(subject)'
52- if node . method_name == :should
52+ case node . method_name
53+ when :should
5354 replacement += '.to'
54- elsif node . method_name == :should_not
55+ when :should_not
5556 replacement += '.not_to'
5657 end
5758
@@ -66,9 +67,10 @@ def valid_usage?(node)
6667 end
6768
6869 def allowed_by_style? ( example )
69- if style == :single_line_only
70+ case style
71+ when :single_line_only
7072 example . single_line?
71- elsif style == :single_statement_only
73+ when :single_statement_only
7274 !example . body . begin_type?
7375 else
7476 false
Original file line number Diff line number Diff line change 2626 describe 'link to related issue on github' do
2727 let ( :issues ) do
2828 entries . map do |entry |
29- entry . match ( /\[ (?<number>[#\d ]+)\] \( (?<url>[^\ ) ]+)\) / )
29+ entry . match ( /\[ (?<number>[#\d ]+)\] \( (?<url>[^)]+)\) / )
3030 end . compact
3131 end
3232
5858 entries . map do |entry |
5959 entry
6060 . sub ( /^\* \s *(?:\[ .+?\) :\s *)?/ , '' )
61- . sub ( /\s *\( [^\ ) ]+\) $/ , '' )
61+ . sub ( /\s *\( [^)]+\) $/ , '' )
6262 end
6363 end
6464
6969 end
7070
7171 it 'ends with a punctuation' do
72- expect ( bodies ) . to all ( match ( /[\. \ ! ]$/ ) )
72+ expect ( bodies ) . to all ( match ( /[. !]$/ ) )
7373 end
7474 end
7575 end
You can’t perform that action at this time.
0 commit comments