<commit_before>module RealWorldRails
  module Inspectors

    class ConstantsInspector
      def run
        raise NotImplementedError, "TODO: Write ConstantsInspector"
      end
    end
    
  end
end<commit_msg>Beginnings of ConstantsInspector<commit_after>module RealWorldRails
  module Inspectors

    class ConstantsInspector
      def run
        parser = ParserFactory.create
        # files = Dir.glob("apps/**/*.rb")
        files = Dir.glob("apps/24pullrequests/**/*.rb")
        processor = Processor.new
        files.each do |filename|
          source = File.read(filename)
          buffer = Parser::Source::Buffer.new filename
          buffer.source = source
          parser.reset
          ast = parser.parse(buffer)
          puts filename
          processor.process(ast)
        end
      end
    end

    class Processor < Parser::AST::Processor
      def on_const(node)
        # require 'pry'
        # require 'pp'
        # binding.pry
        # class_name = node.children.first.children.last
        if node.children.last =~ /^[A-Z]+$/
          puts node.inspect
        end
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.08568904593639576, 'fraction_numerical': 0.0017667844522968198, 'mean_word_length': 1.973753280839895, 'pattern_counts': {'":': 0, '<': 4, '<?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': '1885023', 'n_tokens_mistral': 327, 'n_tokens_neox': 321, 'n_words': 75}