# built in cucu linting rules
---

feature_name_must_not_contain_special_characters:
  message: "feature name must not contain the characters '/\\:?'"
  type: error
  current_line:
    match: '^\s*Feature: .*[/\:?].*'

scenario_name_must_not_contain_special_characters:
  message: "scenario name must not contain the characters '/\\:?'"
  type: error
  current_line:
    match: '^\s*Scenario: .*[/\:?].*'

feature_name_must_be_unique:
  message: feature name must be unique
  type: error
  current_line:
    match: '^\s*Feature: (.*)'
    unique_per_all_features: true

scenario_name_must_be_unique:
  message: scenario name must be unique
  type: error
  current_line:
    match: '^\s*Scenario: (.*)'
    unique_per_all_scenarios: true

feature_name_on_first_line:
  message: feature name should not have any indentation
  type: warning
  current_line:
    match: '^\s+Feature: .*'
  fix:
    match: '^\s*'
    replace: ''

scenario_tags_with_appropriate_indentation:
  message: scenario tags should be indented with 2 spaces
  type: warning
  # any tag line that has 0,1 or 3 or more spaces is a violation
  current_line:
    match: '^(\s{0,1}|\s{3,})@.*'
  next_line:
    match: '^\s*Scenario: (.*)'
  fix:
    match: '^\s*'
    replace: '  '

feature_tags_with_appropriate_indentation:
  message: feature tags should not be indented
  type: warning
  current_line:
    match: '^(\s+)@.*'
  next_line:
    match: '^\s*Feature: (.*)'
  fix:
    match: '^\s*'
    replace: ''

scenario_name_with_appropriate_indentation:
  message: scenario name should be indented with 2 spaces
  type: warning
  # any scenario line that has 0,1 or 3 or more spaces is a violation
  current_line:
    match: '^(\s{0,1}|\s{3,})Scenario: .*'
  fix:
    match: '^\s*'
    replace: '  '

given_keyword_indented_correctly:
  message: given keyword should be indented with 4 spaces
  type: warning
  current_line:
    match: '^(\s{0,3}|\s{5,})Given .*'
  fix:
    match: '^\s*'
    replace: '    '

when_keyword_indented_correctly:
  message: when keyword should be indented with 5 spaces
  type: warning
  current_line:
    match: '^(\s{0,4}|\s{6,})When .*'
  fix:
    match: '^\s*'
    replace: '     '

then_keyword_indented_correctly:
  message: then keyword should be indented with 5 spaces
  type: warning
  current_line:
    match: '^(\s{0,4}|\s{6,})Then .*'
  fix:
    match: '^\s*'
    replace: '     '

and_keyword_indented_correctly:
  message: and keyword should be indented with 6 spaces
  type: warning
  current_line:
    match: '^(\s{0,5}|\s{7,})And .*'
  fix:
    match: '^\s*'
    replace: '      '

line_with_extraneous_whitespace:
  message: line has extraneous whitespace at the end
  type: warning
  current_line:
    match: '^.*[ \t]+$'
  fix:
    match: '[ \t]+$'
    replace: ''

too_many_blank_lines:
  message: too many blank lines
  type: warning
  previous_line:
    match: '^\s*$'
  current_line:
    match: '^\s*$'
  fix:
    delete: true
