Class: PRWithParams::ConventionalCommitValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/pr_with_params/options_validator.rb

Constant Summary collapse

CONVENTIONAL_COMMIT_REGEX =
/^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(!)?(: (.*\s*)*))|(^Merge (.*\s*)*)|(^Initial commit$)/

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ConventionalCommitValidator

Returns a new instance of ConventionalCommitValidator.



30
31
32
# File 'lib/pr_with_params/options_validator.rb', line 30

def initialize(options)
  @commit_message = options[:title]
end

Instance Method Details

#validate!Object



34
35
36
# File 'lib/pr_with_params/options_validator.rb', line 34

def validate!
  raise OptionsValidator::ValidatorError, "Conventional commit specifications not met for commit message: '#{@commit_message}'" unless valid_commit?
end