Skip to content

Commit

Permalink
Update RuboCop 0.43.0 -> 0.45.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sds committed Nov 3, 2016
1 parent 26a589d commit 61b428a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ gem 'rspec', '~> 3.5.0'
gem 'overcommit', '0.37.0'

# Pin tool versions (which are executed by Overcommit) for Travis builds
gem 'rubocop', '0.43.0'
gem 'rubocop', '0.45.0'

gem 'coveralls', require: false
9 changes: 5 additions & 4 deletions lib/scss_lint/linter/duplicate_property.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def value_as_string(value)
when Sass::Script::Funcall
value.name
when Sass::Script::String
nil
when Sass::Script::Tree::Literal
value.value
when Sass::Script::Tree::ListLiteral
Expand All @@ -69,13 +70,13 @@ def value_as_string(value)
def ignore_consecutive_of?(prop)
case @ignore_consecutive
when true
return true
true
when false
return false
false
when nil
return false
false
when Array
return @ignore_consecutive.include?(prop.name.join)
@ignore_consecutive.include?(prop.name.join)
else
raise SCSSLint::Exceptions::LinterError,
"#{@ignore_consecutive.inspect} is not a valid value for ignore_consecutive."
Expand Down
1 change: 1 addition & 0 deletions lib/scss_lint/linter/empty_line_between_blocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def check_preceding_node(node, type)
Sass::Tree::RuleNode,
Sass::Tree::CommentNode
# Ignore
nil
else
unless engine.lines[node.line - 2].strip.empty?
add_lint(node.line, MESSAGE_FORMAT % [type, 'preceded'])
Expand Down
5 changes: 3 additions & 2 deletions lib/scss_lint/linter/final_newline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ def visit_root(_node)
ends_with_newline = engine.lines[-1][-1] == "\n"

if config['present']
add_lint(engine.lines.count,
'Files should end with a trailing newline') unless ends_with_newline
unless ends_with_newline
add_lint(engine.lines.count, 'Files should end with a trailing newline')
end
elsif ends_with_newline
add_lint(engine.lines.count, 'Files should not end with a trailing newline')
end
Expand Down
8 changes: 5 additions & 3 deletions lib/scss_lint/linter/shorthand.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ def check_script_string(prop, script_string)
def check_shorthand(prop, node, values)
values = shorthand_values(values)

add_lint(node, "Shorthands of length `#{values.count}` are not allowed. " \
"Value was `#{values.join(' ')}`") unless allowed?(values.count)
unless allowed?(values.count)
add_lint(node, "Shorthands of length `#{values.count}` are not allowed. " \
"Value was `#{values.join(' ')}`")
end

return unless (2..4).member?(values.count)

Expand Down Expand Up @@ -140,7 +142,7 @@ def condense_to_two_values?(top, right, bottom, left)
# @param right [String]
# @param left [String]
# @return [Boolean]
def condense_to_three_values?(_, right, __, left)
def condense_to_three_values?(_, right, _, left)
return unless allowed?(3)

right == left
Expand Down
8 changes: 5 additions & 3 deletions lib/scss_lint/sass/tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ def children

# Keyword mapping is String -> Expr, so convert the string to a variable
# node that supports lint reporting
keyword_exprs = keywords.as_stored.map do |var_name, var_expr|
[create_variable(var_name), var_expr]
end if keywords.any?
if keywords.any?
keyword_exprs = keywords.as_stored.map do |var_name, var_expr|
[create_variable(var_name), var_expr]
end
end

concat_expr_lists super, args, keyword_exprs, splat
end
Expand Down

0 comments on commit 61b428a

Please sign in to comment.