class CucumberLint::Config

A configuration for executing cucumber_lint

Attributes

fix[R]

Public Class Methods

new(dir:, fix: @dir = dir) click to toggle source
# File lib/cucumber_lint/config.rb, line 9
def initialize dir:, fix:
  @dir = dir
  @fix = fix
  @options = parse_config
end

Public Instance Methods

method_missing(method) click to toggle source
# File lib/cucumber_lint/config.rb, line 16
def method_missing method
  @options.send(method)
end

Private Instance Methods

load_config(path) click to toggle source

rubocop:enable Metrics/MethodLength

# File lib/cucumber_lint/config.rb, line 44
def load_config path
  return {} unless File.exist? path
  YAML.load File.read path
end
load_default_config() click to toggle source
# File lib/cucumber_lint/config.rb, line 50
def load_default_config
  load_config "#{File.dirname(__FILE__)}/../../config/default.yml"
end
parse_config() click to toggle source

rubocop:disable Metrics/MethodLength

# File lib/cucumber_lint/config.rb, line 24
def parse_config
  defaults = load_default_config
  overrides = load_config "#{@dir}/cucumber_lint.yml"

  overrides.each_pair do |style, style_overrides|
    style_overrides.each_pair do |key, value|
      if key == 'enforced_style'
        supported = defaults[style]['supported_styles']
        fail UnsupportedStyle.new style, supported, value unless supported.include?(value)
      end

      defaults[style][key] = value
    end
  end

  defaults.to_open_struct
end