<commit_before>require 'orc/cmdb/namespace'

class Orc::CMDB::GroupActions
  def initialize(spec, logger)
    @spec = spec
    @logger = logger
  end

  def install(groups, version, for_group = 'all')
    groups.each do |group|
      if group[:name] == for_group || all_groups?(for_group)
        if group[:target_participation]
          if group[:never_swap] 
            group[:target_version] = version 
          else
            @logger.log("Not installing to group #{group[:name]} - consider setting never_swap")
          end
        else
          group[:target_version] = version
        end
      end
    end

    swappable_groups = swappable(groups)

    if swappable_groups.size == 1
      if all_groups?(for_group)
        swappable_groups[0][:target_version] = version
      else

        @logger.log("Refusing to install: version: '#{version}' for group: '#{for_group}'. " \
          "Application: '#{@spec[:application]}', environment: '#{@spec[:environment]}'\n" \
          "Group 'blue' is the only swappable group (never_swap=false)\n" \
          "In order to install a new version using swap, a minimum of 2 swappable groups are required")
      end
    end

    groups
  end

  def limited_install(groups, version)
    min_group = groups.min_by { |g| Gem::Version.new(g[:target_version]) }
    min_group[:target_version] = version<commit_msg>Helen: Fixing orc linting<commit_after>require 'orc/cmdb/namespace'

class Orc::CMDB::GroupActions
  def initialize(spec, logger)
    @spec = spec
    @logger = logger
  end

  def install(groups, version, for_group = 'all')
    groups.each do |group|
      if group[:name] == for_group || all_groups?(for_group)
        if group[:target_participation]
          if group[:never_swap]
            group[:target_version] = version
          else
            @logger.log("Not installing to group #{group[:name]} - consider setting never_swap")
          end
        else
          group[:target_version] = version
        end
      end
    end

    swappable_groups = swappable(groups)

    if swappable_groups.size == 1
      if all_groups?(for_group)
        swappable_groups[0][:target_version] = version
      else

        @logger.log("Refusing to install: version: '#{version}' for group: '#{for_group}'. " \
          "Application: '#{@spec[:application]}', environment: '#{@spec[:environment]}'\n" \
          "Group 'blue' is the only swappable group (never_swap=false)\n" \
          "In order to install a new version using swap, a minimum of 2 swappable groups are required")
      end
    end

    groups
  end

  def limited_install(groups, version)
    min_group = groups.min_by { |g| Gem::Version.new(g[:target_version]) }
    min_group[:target_version] = version
{'fraction_non_alphanumeric': 0.1162536443148688, 'fraction_numerical': 0.002186588921282799, 'mean_word_length': 2.78099173553719, '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': '963104', 'n_tokens_mistral': 836, 'n_tokens_neox': 815, 'n_words': 214}