Class: Git::Lint::Analyzers::Commits::Many

Inherits:
Object
  • Object
show all
Defined in:
lib/git/lint/analyzers/commits/many.rb

Overview

Runs all analyzers for a single commit only.

Constant Summary collapse

ANALYZERS =
[Analyzers::Commits::Subjects::Duplicate].freeze

Instance Method Summary collapse

Constructor Details

#initialize(analyzers: ANALYZERS) ⇒ Many

Returns a new instance of Many.



15
16
17
18
# File 'lib/git/lint/analyzers/commits/many.rb', line 15

def initialize(analyzers: ANALYZERS, **)
  super(**)
  @analyzers = analyzers
end

Instance Method Details

#call(commits = Core::EMPTY_ARRAY) ⇒ Object



20
21
22
23
24
25
# File 'lib/git/lint/analyzers/commits/many.rb', line 20

def call commits = Core::EMPTY_ARRAY
  analyzers.select { |analyzer| settings.public_send :"#{analyzer.id}_enabled" }
           .each { |analyzer| collector.add analyzer.new(commits) }

  collector
end