<commit_before># encoding: utf-8

module Rubocop
  module Cop
    class ClassAndModuleCamelCase < Cop
      MSG = 'Use CamelCase for classes and modules.'

      def inspect(file, source, tokens, ast)
        on_node([:class, :module], ast) do |s|
          name = s.src.name.to_source

          add_offence(:convention, s.src.line, MSG) if name =~ /_/
        end
      end
    end
  end
end<commit_msg>Port ClassAndModuleCamelCase cop to AST::Processor<commit_after># encoding: utf-8

module Rubocop
  module Cop
    class ClassAndModuleCamelCase < Cop
      MSG = 'Use CamelCase for classes and modules.'

      def on_class(node)
        check_name(node)

        super
      end

      def on_module(node)
        check_name(node)

        super
      end

      private

      def check_name(node)
        name = node.src.name.to_source

        add_offence(:convention, node.src.line, MSG) if name =~ /_/
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08404255319148936, 'fraction_numerical': 0.002127659574468085, 'mean_word_length': 2.179054054054054, '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': '4883736', 'n_tokens_mistral': 314, 'n_tokens_neox': 301, 'n_words': 83}