lib/scss_lint/linter/indentation.rb in scss-lint-0.33.0 vs lib/scss_lint/linter/indentation.rb in scss-lint-0.34.0
- old
+ new
@@ -47,11 +47,11 @@
"Line should be indented with #{character_name}s, " \
"not #{other_character_name}s")
return true
end
- unless actual_indent.length == @indent
+ unless allow_arbitrary_indent?(node) || actual_indent.length == @indent
add_lint(node.line,
"Line should be indented #{@indent} #{character_name}s, " \
"but was indented #{actual_indent.length} #{character_name}s")
return true
end
@@ -127,8 +127,14 @@
def at_root_contains_inline_selector?(node)
return unless node.children.any?
return unless first_child_source = node.children.first.source_range
same_position?(node.source_range.end_pos, first_child_source.start_pos)
+ end
+
+ def allow_arbitrary_indent?(node)
+ @indent == 0 &&
+ config['allow_non_nested_indentation'] &&
+ node.is_a?(Sass::Tree::RuleNode)
end
end
end