Class: Danger::DangerSpecPostfix

Inherits:
Plugin
  • Object
show all
Defined in:
lib/spec_postfix/plugin.rb

Instance Method Summary collapse

Instance Method Details

#lint(include_path:, match:, message:, exclude_path: nil) ⇒ void

This method returns an undefined value.

Lints files (or directories) naming. Generates a ‘string` with warning.



17
18
19
20
21
# File 'lib/spec_postfix/plugin.rb', line 17

def lint(include_path:, match:, message:, exclude_path: nil)
  wrong_files = changed_files.select { |f| f.match?(include_path) }.reject { |f| f.match?(match) }
  wrong_files = wrong_files.reject { |f| f.match?(exclude_path) } if exclude_path
  wrong_files.each { |f| warn("#{message}: #{f}") }
end