Class: CodeownerValidator::Tasks::Base
- Inherits:
-
Object
- Object
- CodeownerValidator::Tasks::Base
- 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.
Direct Known Subclasses
DuplicateChecker, FileExistsChecker, MissingAssignmentChecker, SyntaxChecker, Validator
Instance Method Summary collapse
-
#codeowners ⇒ CodeownerValidator::CodeOwners
Public: Returns the codeowner object associated to the repository selected.
-
#comments ⇒ Array
Public: Executes all tasks and responds with an array of comments.
-
#execute ⇒ Object
Public: Executes task’s commands.
-
#initialize(verbose: false, repo_path:, **_args) ⇒ Base
constructor
Public: Initializing the task with provided arguments.
-
#summary ⇒ Object
Public: Returns the summary of what the task is to accomplish.
Methods included from UtilityHelper
Methods included from Command
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
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
#codeowners ⇒ CodeownerValidator::CodeOwners
Public: Returns the codeowner object associated to the repository selected
44 45 46 |
# File 'lib/codeowner_validator/common/tasks/base.rb', line 44 def codeowners @codeowners ||= CodeOwners.new(repo_path: @repo_path) end |
#comments ⇒ Array
Public: Executes all tasks and responds with an array of comments
39 |
# File 'lib/codeowner_validator/common/tasks/base.rb', line 39 def comments; end |
#execute ⇒ Object
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 |
#summary ⇒ Object
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 |