lib/scss_lint/linter.rb in scss-lint-0.25.1 vs lib/scss_lint/linter.rb in scss-lint-0.26.0
- old
+ new
@@ -8,28 +8,37 @@
def initialize
@lints = []
end
+ # Run this linter against a parsed document with a given configuration.
+ #
# @param engine [Engine]
# @param config [Config]
def run(engine, config)
@config = config
@engine = engine
visit(engine.tree)
end
+ # Return the human-friendly name of this linter as specified in the
+ # configuration file and in lint descriptions.
+ def name
+ self.class.name.split('::')[2..-1].join('::')
+ end
+
protected
# Helper for creating lint from a parse tree node
#
# @param node_or_line_or_location [Sass::Script::Tree::Node, Fixnum, SCSSLint::Location]
# @param message [String]
def add_lint(node_or_line_or_location, message)
@lints << Lint.new(self,
engine.filename,
extract_location(node_or_line_or_location),
- message)
+ message,
+ @config.fetch('severity', :warning).to_sym)
end
# Extract {SCSSLint::Location} from a {Sass::Source::Range}.
#
# @param range [Sass::Source::Range]