<commit_before>require 'semantic'

module Autoversion
  class SemVer < ::Semantic::Version

    def increment type
      version = [0,0,0]
      found = false
      [:major, :minor, :patch].each_with_index do |seg, i|
        if found
          version[i] = 0
        end

        if seg == type
          old = instance_variable_get("@#{seg}")
          version[i] = old+1
          found = true
        end
      end

      SemVer.new version.join '.'
    end

  end<commit_msg>Fixed a bug in the SemVer class which zeroed the entire version on each increment<commit_after>require 'semantic'

module Autoversion
  class SemVer < ::Semantic::Version

    def increment type
      version = to_a
      found = false
      [:major, :minor, :patch].each_with_index do |seg, i|
        if found
          version[i] = 0
        end

        if seg == type
          old = instance_variable_get("@#{seg}")
          version[i] = old+1
          found = true
        end
      end

      SemVer.new version.reject{|v| v.nil? }.join '.'
    end

  end
{'fraction_non_alphanumeric': 0.10047846889952153, 'fraction_numerical': 0.0066985645933014355, 'mean_word_length': 1.8975069252077563, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3483282', 'n_tokens_mistral': 328, 'n_tokens_neox': 316, 'n_words': 95}