<commit_before># frozen_string_literal: true

module Dome
  module Level
    # FIXME: Remove dependency on *pwd* and reduce complexity
    # rubocop:disable Metrics/PerceivedComplexity
    def level
      directories = Dir.pwd.split('/')

      if directories[-1] == 'terraform'
        'product'
      elsif directories[-2] == 'terraform'
        'ecosystem'
      elsif directories[-3] == 'terraform'
        'environment'
      elsif directories[-4] == 'terraform' && directories[-1] == 'roles'
        'roles'
      elsif directories[-5] == 'terraform' && directories[-2] == 'secrets' && directories[-1] == 'init'
        'secrets-init'
      elsif directories[-5] == 'terraform' && directories[-2] == 'secrets' && directories[-1] == 'config'
        'secrets-config'
      else
        puts 'Invalid level: root'.colorize(:red)
        'root'
      end
    end
    # rubocop:enable Metrics/PerceivedComplexity
  end
end<commit_msg>drop the directory name roles when checking for level under env. this will be useful to run dome in same env level but applying to different resources<commit_after># frozen_string_literal: true

module Dome
  module Level
    # FIXME: Remove dependency on *pwd* and reduce complexity
    # rubocop:disable Metrics/PerceivedComplexity
    def level
      directories = Dir.pwd.split('/')

      if directories[-1] == 'terraform'
        'product'
      elsif directories[-2] == 'terraform'
        'ecosystem'
      elsif directories[-3] == 'terraform'
        'environment'
      elsif directories[-4] == 'terraform'
        'roles'
      elsif directories[-5] == 'terraform' && directories[-2] == 'secrets' && directories[-1] == 'init'
        'secrets-init'
      elsif directories[-5] == 'terraform' && directories[-2] == 'secrets' && directories[-1] == 'config'
        'secrets-config'
      else
        puts 'Invalid level: root'.colorize(:red)
        'root'
      end
    end
    # rubocop:enable Metrics/PerceivedComplexity
  end
end
{'fraction_non_alphanumeric': 0.1303688731682668, 'fraction_numerical': 0.010611419909044972, 'mean_word_length': 2.800383877159309, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3711387', 'n_tokens_mistral': 618, 'n_tokens_neox': 601, 'n_words': 157}