Class: Chutney::AvoidSplatStepsInBackground

Inherits:
Linter
  • Object
show all
Defined in:
lib/chutney/linter/avoid_splat_steps_in_background.rb

Overview

service class to lint for avoiding splats

Instance Attribute Summary

Attributes inherited from Linter

#configuration, #filename, #issues

Instance Method Summary collapse

Methods inherited from Linter

#add_issue, #and_word?, #background, #background_word?, #but_word?, descendants, #dialect, #dialect_word, #elements, #examples_word?, #feature, #feature_word?, #filled_scenarios, #given_word?, #initialize, linter_name, #linter_name, #location, #off_switch?, #render_step, #render_step_argument, #scenario_outline_word?, #scenarios, #steps, #tags_for, #then_word?, #type, #when_word?

Constructor Details

This class inherits a constructor from Chutney::Linter

Instance Method Details

#lintObject



6
7
8
9
10
11
12
13
14
# File 'lib/chutney/linter/avoid_splat_steps_in_background.rb', line 6

def lint
  background do |feature, background|
    splat_steps = background&.steps&.select { |s| s.keyword == '*' }
    # add_issue(I18n.t('linters.avoid_full_stop'), feature, child, step) if step.text.strip.end_with? '.'
    if splat_steps && !splat_steps.empty?
      add_issue(I18n.t('linters.avoid_splat_steps_in_background'), feature, background, splat_steps.first)
    end
  end
end