class Greener::Checker::Style::IndentationWidth

Ensure keywords are indented correctly Ref: github.com/bbatsov/rubocop/commit/44c1cdd5d9bc1c3588ea7841fc6e9543126306e8

Constants

MSG

Public Instance Methods

check_a_step(step) click to toggle source
# File lib/greener/checker/style/indentation_width.rb, line 33
def check_a_step(step) # nil if a scenario has no steps, or
  # {:type=>:Step, :location=>{:line=>6, :column=>5}, :keyword=>"Then ", :text=>"nothing"}
  return if step[:location][:column] == (1 + configured_indentation_width * 2)
  log_violation(step[:location][:line], step[:location][:column])
end
check_every_scenario() click to toggle source
# File lib/greener/checker/style/indentation_width.rb, line 23
def check_every_scenario
  scenarios = feature[:scenarioDefinitions] || feature[:children]
  scenarios.each do |scenario|
    scenario[:steps].each { |step| check_a_step(step) }

    next if scenario[:location][:column] == (1 + configured_indentation_width)
    log_violation(scenario[:location][:line], scenario[:location][:column])
  end
end
check_feature_line() click to toggle source
# File lib/greener/checker/style/indentation_width.rb, line 18
def check_feature_line
  return if feature[:location][:column] == 1
  log_violation(feature[:location][:line], feature[:location][:column])
end
configured_indentation_width() click to toggle source
# File lib/greener/checker/style/indentation_width.rb, line 39
def configured_indentation_width
  @config["Width"]
end
run() click to toggle source
# File lib/greener/checker/style/indentation_width.rb, line 11
def run
  return unless @config["Enabled"]

  check_feature_line
  check_every_scenario
end