Sha256: f3ea511935d0ddd9f86545ee54361a116859ecb830b8fc1e53b7660f1a833f3e
Contents?: true
Size: 657 Bytes
Versions: 9
Compression:
Stored size: 657 Bytes
Contents
module Chutney # service class to lint for avoid scripting class AvoidScripting < Linter def lint scenarios do |feature, scenario| when_steps = filter_when_steps(scenario[:steps]) whens = when_steps.count add_issue(I18n.t('linters.avoid_scripting', count: whens), feature, scenario, when_steps.last) if whens > 1 end end def filter_when_steps(steps) steps .drop_while { |step| !when_word?(step[:keyword]) } .then { |s| s.reverse.drop_while { |step| !then_word?(step[:keyword]) }.reverse } .then { |s| s.reject { |step| then_word?(step[:keyword]) } } end end end
Version data entries
9 entries across 9 versions & 1 rubygems