Skip to content

Commit

Permalink
Change the max line length of Layout/LineLength to 120
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed May 12, 2020
1 parent cdfb4b5 commit b8e2510
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 25 deletions.
4 changes: 1 addition & 3 deletions lib/rubocop/cop/mixin/active_record_helper.rb
Expand Up @@ -15,9 +15,7 @@ module ActiveRecordHelper
PATTERN

def external_dependency_checksum
if defined?(@external_dependency_checksum)
return @external_dependency_checksum
end
return @external_dependency_checksum if defined?(@external_dependency_checksum)

schema_path = RuboCop::Rails::SchemaLoader.db_schema_path
return nil if schema_path.nil?
Expand Down
4 changes: 1 addition & 3 deletions lib/rubocop/cop/rails/create_table_with_timestamps.rb
Expand Up @@ -70,9 +70,7 @@ def on_send(node)
parent = node.parent

if create_table_with_block?(parent)
if parent.body.nil? || !time_columns_included?(parent.body)
add_offense(parent)
end
add_offense(parent) if parent.body.nil? || !time_columns_included?(parent.body)
elsif create_table_with_timestamps_proc?(node)
# nothing to do
else
Expand Down
4 changes: 1 addition & 3 deletions lib/rubocop/cop/rails/delegate.rb
Expand Up @@ -71,9 +71,7 @@ def autocorrect(node)
delegation = ["delegate :#{node.body.method_name}",
"to: :#{node.body.receiver.method_name}"]

if node.method?(prefixed_method_name(node.body))
delegation << ['prefix: true']
end
delegation << ['prefix: true'] if node.method?(prefixed_method_name(node.body))

lambda do |corrector|
corrector.replace(node.source_range, delegation.join(', '))
Expand Down
4 changes: 1 addition & 3 deletions lib/rubocop/cop/rails/link_to_blank.rb
Expand Up @@ -42,9 +42,7 @@ def on_send(node)

option_nodes.map(&:children).each do |options|
blank = options.find { |o| blank_target?(o) }
if blank && options.none? { |o| includes_noopener?(o) }
add_offense(blank)
end
add_offense(blank) if blank && options.none? { |o| includes_noopener?(o) }
end
end

Expand Down
8 changes: 2 additions & 6 deletions lib/rubocop/cop/rails/presence.rb
Expand Up @@ -76,15 +76,11 @@ def on_if(node)
return if ignore_if_node?(node)

redundant_receiver_and_other(node) do |receiver, other|
unless ignore_other_node?(other) || receiver.nil?
add_offense(node, message: message(node, receiver, other))
end
add_offense(node, message: message(node, receiver, other)) unless ignore_other_node?(other) || receiver.nil?
end

redundant_negative_receiver_and_other(node) do |receiver, other|
unless ignore_other_node?(other) || receiver.nil?
add_offense(node, message: message(node, receiver, other))
end
add_offense(node, message: message(node, receiver, other)) unless ignore_other_node?(other) || receiver.nil?
end
end

Expand Down
4 changes: 1 addition & 3 deletions lib/rubocop/cop/rails/save_bang.rb
Expand Up @@ -218,9 +218,7 @@ def array_parent(node)
def check_used_in_condition_or_compound_boolean(node)
return false unless in_condition_or_compound_boolean?(node)

unless MODIFY_PERSIST_METHODS.include?(node.method_name)
add_offense_for_node(node, CREATE_CONDITIONAL_MSG)
end
add_offense_for_node(node, CREATE_CONDITIONAL_MSG) unless MODIFY_PERSIST_METHODS.include?(node.method_name)

true
end
Expand Down
4 changes: 1 addition & 3 deletions lib/rubocop/cop/rails/time_zone.rb
Expand Up @@ -85,9 +85,7 @@ def autocorrect(node)
end

# prefer `Time` over `DateTime` class
if strict?
corrector.replace(node.children.first.source_range, 'Time')
end
corrector.replace(node.children.first.source_range, 'Time') if strict?
remove_redundant_in_time_zone(corrector, node)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/project_spec.rb
Expand Up @@ -142,7 +142,7 @@
it 'has a valid URL' do
issues.each do |issue|
number = issue[:number].gsub(/\D/, '')
pattern = %r{^https://github\.com/rubocop-hq/rubocop-rails/(?:issues|pull)/#{number}$} # rubocop:disable Layout/LineLength
pattern = %r{^https://github\.com/rubocop-hq/rubocop-rails/(?:issues|pull)/#{number}$}
expect(issue[:url]).to match(pattern)
end
end
Expand Down

0 comments on commit b8e2510

Please sign in to comment.