lib/slim_lint/reporter.rb in slim_lint-0.2.0 vs lib/slim_lint/reporter.rb in slim_lint-0.3.0
- old
+ new
@@ -1,36 +1,42 @@
module SlimLint
- # Abstract lint reporter. Subclass and override {#report_lints} to
+ # Abstract lint reporter. Subclass and override {#display_report} to
# implement a custom lint reporter.
#
# @abstract
class Reporter
- attr_reader :lints
- attr_reader :files
-
+ # Creates the reporter that will display the given report.
+ #
# @param logger [SlimLint::Logger]
- # @param report [SlimLint::Report]
- def initialize(logger, report)
+ def initialize(logger)
@log = logger
- @lints = report.lints
- @files = report.files
end
# Implemented by subclasses to display lints from a {SlimLint::Report}.
- def report_lints
- raise NotImplementedError
+ #
+ # @param report [SlimLint::Report]
+ def display_report(report)
+ raise NotImplementedError,
+ "Implement `display_report` to display #{report}"
end
- # Keep tracking all the descendants of this class for the list of available reporters
+ # Keep tracking all the descendants of this class for the list of available
+ # reporters.
+ #
+ # @return [Array<Class>]
def self.descendants
@descendants ||= []
end
+ # Executed when this class is subclassed.
+ #
+ # @param descendant [Class]
def self.inherited(descendant)
descendants << descendant
end
private
+ # @return [SlimLint::Logger] logger to send output to
attr_reader :log
end
end