<commit_before>require 'rollbar'
require 'rollbar/notifier'

describe Rollbar::Notifier do
  describe '#scope' do
    let(:new_scope) do
      { 'foo' => 'bar' }
    end
    let(:new_config) do
      { 'environment' => 'foo' }
    end

    it 'creates a new notifier with merged scope and configuration' do
      new_notifier = subject.scope(new_scope, new_config)

      expect(new_notifier).not_to be(subject)
      expect(subject.configuration.environment).to be_eql(nil)
      expect(new_notifier.configuration.environment).to be_eql('foo')
      expect(new_notifier.scope_object['foo']).to be_eql('bar')
      expect(new_notifier.configuration).not_to be(subject.configuration)
      expect(new_notifier.scope_object).not_to be(subject.scope_object)
    end
  end

  describe '#scope!' do
    let(:new_scope) do
      { 'foo' => 'bar' }
    end
    let(:new_config) do
      { 'environment' => 'foo' }
    end

    it 'mutates the notifier with a merged scope and configuration' do
      result = subject.scope!(new_scope, new_config)

      expect(result).to be(subject)
      expect(subject.configuration.environment).to be_eql('foo')
      expect(subject.scope_object['foo']).to be_eql('bar')
      expect(subject.configuration).to be(subject.configuration)
      expect(subject.scope_object).to be(subject.scope_object)
    end
  end
  
  if RUBY_PLATFORM == 'java'
    describe "#extract_arguments" do
      it "extracts java.lang.Exception" do
        begin
          raise java.lang.Exception.new("Hello")
        rescue java.lang.Exception => e
          message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
          expect(exception).to eq(e)
        end
      end
      
      it "extracts java.lang.Error" do
        # NOTE: not raising because otherwise you'd get
        # "Unable to infer file and line number from backtrace"
        e = java.lang.OutOfMemoryError.new
        message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
        expect(exception).to eq(e)
      end
    end
  end
end<commit_msg>Fix code to match code checker standards<commit_after>require 'rollbar'
require 'rollbar/notifier'

describe Rollbar::Notifier do
  describe '#scope' do
    let(:new_scope) do
      { 'foo' => 'bar' }
    end
    let(:new_config) do
      { 'environment' => 'foo' }
    end

    it 'creates a new notifier with merged scope and configuration' do
      new_notifier = subject.scope(new_scope, new_config)

      expect(new_notifier).not_to be(subject)
      expect(subject.configuration.environment).to be_eql(nil)
      expect(new_notifier.configuration.environment).to be_eql('foo')
      expect(new_notifier.scope_object['foo']).to be_eql('bar')
      expect(new_notifier.configuration).not_to be(subject.configuration)
      expect(new_notifier.scope_object).not_to be(subject.scope_object)
    end
  end

  describe '#scope!' do
    let(:new_scope) do
      { 'foo' => 'bar' }
    end
    let(:new_config) do
      { 'environment' => 'foo' }
    end

    it 'mutates the notifier with a merged scope and configuration' do
      result = subject.scope!(new_scope, new_config)

      expect(result).to be(subject)
      expect(subject.configuration.environment).to be_eql('foo')
      expect(subject.scope_object['foo']).to be_eql('bar')
      expect(subject.configuration).to be(subject.configuration)
      expect(subject.scope_object).to be(subject.scope_object)
    end
  end
  
  if RUBY_PLATFORM == 'java'
    describe '#extract_arguments' do
      it 'extracts java.lang.Exception' do
        begin
          raise java.lang.Exception.new('Hello')
        rescue java.lang.Exception => e
          message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
          expect(exception).to eq(e)
        end
      end
      
      it 'extracts java.lang.Error' do
        # NOTE: not raising because otherwise you'd get
        # "Unable to infer file and line number from backtrace"
        e = java.lang.OutOfMemoryError.new
        message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
        expect(exception).to eq(e)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11235955056179775, 'fraction_numerical': 0.0, 'mean_word_length': 3.0192122958693566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '4125895', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1275, 'n_words': 295}