Sha256: ac5c0db19e981511e70a5d5f74fa92370f240cd90a6d55d59135f7472986fd4a

Contents?: true

Size: 737 Bytes

Versions: 10

Compression:

Stored size: 737 Bytes

Contents

# frozen_string_literal: true

module Chutney
  # service class to lint for unique scenario names
  class UniqueScenarioNames < Linter
    def lint
      references_by_name = {}
      scenarios do |feature, scenario|
        name = scenario.name
        if references_by_name[name]
          issue(name, references_by_name[name], scenario)
        else
          references_by_name[name] = location(feature, scenario, nil)
        end
      end
    end

    def issue(name, first_location, scenario)
      add_issue(
        I18n.t('linters.unique_scenario_names',
               name: name,
               line: first_location[:line],
               column: first_location[:column]),
        feature, scenario
      )
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
chutney-3.7.0 lib/chutney/linter/unique_scenario_names.rb
chutney-3.6.0 lib/chutney/linter/unique_scenario_names.rb
chutney-3.5.0 lib/chutney/linter/unique_scenario_names.rb
chutney-3.3.0 lib/chutney/linter/unique_scenario_names.rb
chutney-3.2.1 lib/chutney/linter/unique_scenario_names.rb
chutney-3.2.0 lib/chutney/linter/unique_scenario_names.rb
chutney-3.1.1 lib/chutney/linter/unique_scenario_names.rb
chutney-3.1.0 lib/chutney/linter/unique_scenario_names.rb
chutney-3.0.1 lib/chutney/linter/unique_scenario_names.rb
chutney-3.0.0 lib/chutney/linter/unique_scenario_names.rb