<commit_before>module Laser
  Warning = Struct.new(:name, :file, :body, :line_number, :severity) do
    extend ModuleExtensions
    include LexicalAnalysis
    include Analysis

    cattr_accessor :short_name
    cattr_accessor_with_default :match_filters, []
    cattr_get_and_setter :severity, :short_desc, :desc, :fixable
    attr_accessor :settings

    desc { "#{self.class.name} #{file}:#{line_number} (#{severity})" }

    # This tracks all subclasses (and subclasses of subclasses, etc). Plus, this
    # method is inherited, so Laser::LineWarning.all_subclasses will have all
    # subclasses of Laser::LineWarning!
    def self.all_warnings
      @all_warnings ||= [self]
    end
    
    def self.warning_set(named='default')
      list = YAML.load_file(File.join(File.dirname(__FILE__), 'warning_sets', named+'.yml'))
      list.map { |name| Laser.const_get(name) }
    end

    # Returns all "concrete" warnings, that is, those that have an actual
    # implementation. No meta-warnings like FileWarning/LineWarning.
    #
    # @return [Array<Class>] the concrete warnings you might want to use
    def self.concrete_warnings
      all_warnings - [self, FileWarning, LineWarning]
    end

    # All types should be shared and modified by *all* subclasses. This makes
    # Laser::Warning.all_types a global registry.
    def self.all_types
      $all_types ||= Hash.new {|h,k| h[k] = []}
    end

    # When a Warning subclass is subclassed, store the subclass and inform the
    # next superclass up the inheritance hierarchy.
    def self.inherited(klass)
      self.all_warnings << klass
      next_klass = self.superclass
      while next_klass != Laser::Warning.superclass
        next_klass.send(:inherited, klass)
        next_klass = next_klass.superclass
      end<commit_msg>For some reason, @@all_types got changed to $all_types. Fixed.<commit_after>module Laser
  Warning = Struct.new(:name, :file, :body, :line_number, :severity) do
    extend ModuleExtensions
    include LexicalAnalysis
    include Analysis

    cattr_accessor :short_name
    cattr_accessor_with_default :match_filters, []
    cattr_get_and_setter :severity, :short_desc, :desc, :fixable
    attr_accessor :settings

    desc { "#{self.class.name} #{file}:#{line_number} (#{severity})" }

    @@all_types = nil

    # This tracks all subclasses (and subclasses of subclasses, etc). Plus, this
    # method is inherited, so Laser::LineWarning.all_subclasses will have all
    # subclasses of Laser::LineWarning!
    def self.all_warnings
      @all_warnings ||= [self]
    end
    
    def self.warning_set(named='default')
      list = YAML.load_file(File.join(File.dirname(__FILE__), 'warning_sets', named+'.yml'))
      list.map { |name| Laser.const_get(name) }
    end

    # Returns all "concrete" warnings, that is, those that have an actual
    # implementation. No meta-warnings like FileWarning/LineWarning.
    #
    # @return [Array<Class>] the concrete warnings you might want to use
    def self.concrete_warnings
      all_warnings - [self, FileWarning, LineWarning]
    end

    # All types should be shared and modified by *all* subclasses. This makes
    # Laser::Warning.all_types a global registry.
    def self.all_types
      @@all_types ||= Hash.new {|h,k| h[k] = []}
    end

    # When a Warning subclass is subclassed, store the subclass and inform the
    # next superclass up the inheritance hierarchy.
    def self.inherited(klass)
      self.all_warnings << klass
      next_klass = self.superclass
      while next_klass != Laser::Warning.superclass
        next_klass.send(:inherited, klass)
        next_klass = next_klass.superclass
      end
{'fraction_non_alphanumeric': 0.0986107327703623, 'fraction_numerical': 0.0, 'mean_word_length': 3.4081632653061225, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '5069968', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1116, 'n_words': 319}