Class: CodeownerValidator::Tasks::Base

Inherits:
Object
  • Object
show all
Includes:
Command, Logging, UtilityHelper
Defined in:
lib/codeowner_validator/common/tasks/base.rb

Overview

Public: The tasks base class is used for defining the basis for task executions from the importer or merger executors.

Instance Method Summary collapse

Methods included from UtilityHelper

#in_folder, #with_clean_env

Methods included from Command

#run

Methods included from Logging

#log_command, #log_error, #log_info, #log_stderr, #log_verbose, #log_warn, #logger, #program_name

Constructor Details

#initialize(verbose: false, repo_path:, **_args) ⇒ Base

Public: Initializing the task with provided arguments

Parameters:

  • _args (Hash)

    The hash of arguments to utilize for the initialization



20
21
22
23
# File 'lib/codeowner_validator/common/tasks/base.rb', line 20

def initialize(verbose: false, repo_path:, **_args)
  @verbose = verbose
  @repo_path = repo_path
end

Instance Method Details

#codeownersCodeownerValidator::CodeOwners

Public: Returns the codeowner object associated to the repository selected

Returns:



44
45
46
# File 'lib/codeowner_validator/common/tasks/base.rb', line 44

def codeowners
  @codeowners ||= CodeOwners.new(repo_path: @repo_path)
end

#commentsArray

Public: Executes all tasks and responds with an array of comments

Returns:

  • (Array)

    Returns an array of comments from the execution of the tasks to be utilized by the consumer



39
# File 'lib/codeowner_validator/common/tasks/base.rb', line 39

def comments; end

#executeObject

Public: Executes task’s commands



32
33
34
# File 'lib/codeowner_validator/common/tasks/base.rb', line 32

def execute
  comments&.each { |c| log_error c.comment }
end

#summaryObject

Public: Returns the summary of what the task is to accomplish. Expectation that each task will define its intent which overrides just the class name output.



27
28
29
# File 'lib/codeowner_validator/common/tasks/base.rb', line 27

def summary
  self.class.name
end