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

Increase code coverage #6742

Merged
merged 2 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions lib/rubocop/cop/layout/closing_heredoc_indentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ def opening_indentation(node)
indent_level(heredoc_opening(node))
end

def empty_heredoc?(node)
node.loc.heredoc_body.source.empty? || !contents_indentation(node)
end

def argument_indentation_correct?(node)
return unless node.argument? || node.chained?

Expand All @@ -86,14 +82,6 @@ def argument_indentation_correct?(node)
) == closing_indentation(node)
end

def contents_indentation(node)
source_lines = node.loc.heredoc_body.source.split("\n")

source_lines.reject(&:empty?).map do |line|
indent_level(line)
end.min
end

def closing_indentation(node)
indent_level(heredoc_closing(node))
end
Expand Down
5 changes: 0 additions & 5 deletions lib/rubocop/cop/style/yoda_condition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ def yoda_compatible_condition?(node)
!noncommutative_operator?(node)
end

def both_literals?(node)
lhs, _operator, rhs = *node
lhs.literal? && rhs.literal?
end

def valid_yoda?(node)
lhs, _operator, rhs = *node

Expand Down
4 changes: 3 additions & 1 deletion spec/rubocop/cop/lint/implicit_string_concatenation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
expect_offense(<<-RUBY.strip_indent)
class A; "abc" "def"; end
^^^^^^^^^^^ Combine "abc" and "def" into a single string literal, rather than using implicit string concatenation.
class B; 'ghi' 'jkl'; end
^^^^^^^^^^^ Combine 'ghi' and 'jkl' into a single string literal, rather than using implicit string concatenation.
RUBY
end
end
Expand All @@ -32,7 +34,7 @@ class A; "abc" "def"; end
context 'when the string literals contain newlines' do
it 'registers an offense' do
inspect_source(<<-RUBY.strip_indent)
def method; "ab\\nc" "de\\nf"; end
def method; "ab\nc" "de\nf"; end
RUBY

expect(cop.offenses.size).to eq(1)
Expand Down