<commit_before>class CSVParser

  def parseCSV(inputFilename)
    returnHash = {
      :DEPENDENCIES => [],
      :DEFINITIONS => []
    }

    f = File.open(inputFilename)

    f.each_line do |line|
      if line.nil? || line.chomp.empty?
        # ignores empty lines
      elsif line.start_with?("#")
        # detect command
        if(line.start_with?("#ADD_DEPENDENCY "))
          returnHash[:DEPENDENCIES].push(line.split(" ")[1])
        elsif(line.start_with?("# ADD_DEPENDENCY "))
          returnHash[:DEPENDENCIES].push(line.split(" ")[2])
        end
      elsif line.start_with?("//")
        # ignores comments
      else
        array = line.split(";").map { |a| a.strip }
        arguments = array[3..-1]
        argumentHashes = nil
        unless arguments.nil?
          arguments.reject { |a| a.empty? }
          argumentHashes = arguments.map do |a|
            hash = nil
            if(a.include?(":"))
              hash = {
                :argumentName => a.split(":").first.strip,
                :argumentType => a.split(":").last.strip
              }
            else
              hash = {
                :argumentName => a.downcase,
                :argumentType => a
              }
            end
            hash
          end
        end

        baseClass = array[0]

        targetClass = array[1]

        if targetClass.nil?
          targetClass = baseClass
        end

        targetClassName = targetClass.gsub("<", "").gsub(">", "").gsub(".", "")

        name = array[2]

        hash = {
          :baseClass => baseClass,
          :targetClass => targetClass,
          :targetClassName => targetClassName,
          :name => name,
          :arguments => argumentHashes
        }

        returnHash[:DEFINITIONS].push hash
      end
    end
    return returnHash
  end

end<commit_msg>Use a typical nil guard, and remove redundant empty lines around there.<commit_after>class CSVParser

  def parseCSV(inputFilename)
    returnHash = {
      :DEPENDENCIES => [],
      :DEFINITIONS => []
    }

    f = File.open(inputFilename)

    f.each_line do |line|
      if line.nil? || line.chomp.empty?
        # ignores empty lines
      elsif line.start_with?("#")
        # detect command
        if(line.start_with?("#ADD_DEPENDENCY "))
          returnHash[:DEPENDENCIES].push(line.split(" ")[1])
        elsif(line.start_with?("# ADD_DEPENDENCY "))
          returnHash[:DEPENDENCIES].push(line.split(" ")[2])
        end
      elsif line.start_with?("//")
        # ignores comments
      else
        array = line.split(";").map { |a| a.strip }
        arguments = array[3..-1]
        argumentHashes = nil
        unless arguments.nil?
          arguments.reject { |a| a.empty? }
          argumentHashes = arguments.map do |a|
            hash = nil
            if(a.include?(":"))
              hash = {
                :argumentName => a.split(":").first.strip,
                :argumentType => a.split(":").last.strip
              }
            else
              hash = {
                :argumentName => a.downcase,
                :argumentType => a
              }
            end
            hash
          end
        end

        baseClass = array[0]
        targetClass = array[1] || baseClass
        targetClassName = targetClass.gsub("<", "").gsub(">", "").gsub(".", "")
        name = array[2]

        hash = {
          :baseClass => baseClass,
          :targetClass => targetClass,
          :targetClassName => targetClassName,
          :name => name,
          :arguments => argumentHashes
        }

        returnHash[:DEFINITIONS].push hash
      end
    end
    return returnHash
  end

end
{'fraction_non_alphanumeric': 0.13142857142857142, 'fraction_numerical': 0.0038095238095238095, 'mean_word_length': 1.5923836389280677, 'pattern_counts': {'":': 6, '<': 5, '<?xml version=': 0, '>': 27, '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': '2298085', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1055, 'n_words': 214}